+ Post New Thread
Page 1 of 2 12 LastLast
Results 1 to 15 of 24
Home Access Plus+ Thread, Login Tracker in Projects:; Hi, I'm trying to get the login tracker working. Our HAP install is chugging away nicely, but I've been asked ...
  1. #1
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79

    Login Tracker

    Hi,

    I'm trying to get the login tracker working. Our HAP install is chugging away nicely, but I've been asked to get this bit working.

    I can't see to get it to work with an SQL database on another Server.

    HAP is currently installed on a server called "Virtual"
    The AppPool is called "HAP"
    SQL Server is on another Server "CSS"
    SQL Database is/would be called "logintracker"

    I can not get the SQL to connect to the IIS APPPOOL\HAP no matter what combination I use. Can anyone help? or can I use an XML file to store the data still?

    Regards,

    Michael

  2. #2

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    Try this connection string

    Code:
    Server=myServerAddress;Database=myDataBase;User Id=myUsername;Password=myPassword;
    Where User Id and Password are a user account on that SQL server mapped to that SQL database

  3. #3
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    Hi Nick,

    Do I have to make any changes to the login.sql file too before importing it?

    I'm trying to import it directly with SQL Server Management Studio and get the following error message:

    Code:
    Msg 102, Level 15, State 1, Line 10
    Incorrect syntax near '='.
    Msg 102, Level 15, State 1, Line 25
    Incorrect syntax near '`'.
    Msg 102, Level 15, State 1, Line 38
    Incorrect syntax near '`'.
    Msg 102, Level 15, State 1, Line 61
    Incorrect syntax near '`'.
    Msg 102, Level 15, State 1, Line 74
    Incorrect syntax near '`'.
    Thanks,

    Michael
    Last edited by linkazoid; 11th June 2013 at 09:24 AM.

  4. #4

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    You shouldn't need to, you should be able to open the .sql file in notepad and run the query on the db

  5. #5
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    Every time I try to execute the .sql I get the error above.

  6. #6

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    Which version of SQL are you using?

  7. #7
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    I'm trying to use SQL 2008 SP3

  8. #8

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    Hmm, odd it should work with that. I don't know what to say, the MS SQL doesn't seem to like the SQL script that generates the database

  9. #9
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    Could I create the tables manually?

    I really need to get this to work..

  10. #10

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    Try this
    Code:
    USE [hap]
    GO
    /****** Object:  Table [dbo].[TrackerEvents]    Script Date: 12/06/2013 12:07:50 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[TrackerEvents](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [LogonDateTime] [datetime] NOT NULL,
        [Username] [nvarchar](50) NOT NULL,
        [ComputerName] [nvarchar](50) NOT NULL,
        [LogoffDateTime] [datetime] NULL,
        [domainname] [nvarchar](50) NOT NULL,
        [ip] [nvarchar](50) NOT NULL,
        [logonserver] [nvarchar](50) NOT NULL,
        [os] [nvarchar](50) NOT NULL,
     CONSTRAINT [PK_TrackerEvents_1] PRIMARY KEY CLUSTERED 
    (
        [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    /****** Object:  Table [dbo].[WebTrackerEvents]    Script Date: 12/06/2013 12:07:50 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[WebTrackerEvents](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [DateTime] [datetime] NOT NULL,
        [Username] [nvarchar](50) NOT NULL,
        [ComputerName] [nvarchar](50) NOT NULL,
        [EventType] [nvarchar](50) NOT NULL,
        [IP] [nvarchar](50) NOT NULL,
        [Browser] [nvarchar](50) NOT NULL,
        [OS] [nvarchar](50) NOT NULL,
        [Details] [nvarchar](max) NOT NULL,
     CONSTRAINT [PK_WebTrackerEvents_1] PRIMARY KEY CLUSTERED 
    (
        [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    
    GO

  11. Thanks to nickbro from:

    linkazoid (12th June 2013)

  12. #11

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    This scripts, creates the database as well (you need to change the paths at the top, as I've generated these from SQL 2012
    Code:
    USE [master]
    GO
    /****** Object:  Database [hap]    Script Date: 12/06/2013 12:09:53 ******/
    CREATE DATABASE [hap]
     CONTAINMENT = NONE
     ON  PRIMARY 
    ( NAME = N'hap', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\hap.mdf' , SIZE = 129024KB , MAXSIZE = UNLIMITED, FILEGROWTH = 1024KB )
     LOG ON 
    ( NAME = N'hap_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\hap_log.ldf' , SIZE = 10240KB , MAXSIZE = 2048GB , FILEGROWTH = 10%)
    GO
    ALTER DATABASE [hap] SET COMPATIBILITY_LEVEL = 100
    GO
    IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
    begin
    EXEC [hap].[dbo].[sp_fulltext_database] @action = 'enable'
    end
    GO
    ALTER DATABASE [hap] SET ANSI_NULL_DEFAULT OFF 
    GO
    ALTER DATABASE [hap] SET ANSI_NULLS OFF 
    GO
    ALTER DATABASE [hap] SET ANSI_PADDING OFF 
    GO
    ALTER DATABASE [hap] SET ANSI_WARNINGS OFF 
    GO
    ALTER DATABASE [hap] SET ARITHABORT OFF 
    GO
    ALTER DATABASE [hap] SET AUTO_CLOSE OFF 
    GO
    ALTER DATABASE [hap] SET AUTO_CREATE_STATISTICS ON 
    GO
    ALTER DATABASE [hap] SET AUTO_SHRINK ON 
    GO
    ALTER DATABASE [hap] SET AUTO_UPDATE_STATISTICS ON 
    GO
    ALTER DATABASE [hap] SET CURSOR_CLOSE_ON_COMMIT OFF 
    GO
    ALTER DATABASE [hap] SET CURSOR_DEFAULT  GLOBAL 
    GO
    ALTER DATABASE [hap] SET CONCAT_NULL_YIELDS_NULL OFF 
    GO
    ALTER DATABASE [hap] SET NUMERIC_ROUNDABORT OFF 
    GO
    ALTER DATABASE [hap] SET QUOTED_IDENTIFIER OFF 
    GO
    ALTER DATABASE [hap] SET RECURSIVE_TRIGGERS OFF 
    GO
    ALTER DATABASE [hap] SET  DISABLE_BROKER 
    GO
    ALTER DATABASE [hap] SET AUTO_UPDATE_STATISTICS_ASYNC ON 
    GO
    ALTER DATABASE [hap] SET DATE_CORRELATION_OPTIMIZATION OFF 
    GO
    ALTER DATABASE [hap] SET TRUSTWORTHY OFF 
    GO
    ALTER DATABASE [hap] SET ALLOW_SNAPSHOT_ISOLATION OFF 
    GO
    ALTER DATABASE [hap] SET PARAMETERIZATION SIMPLE 
    GO
    ALTER DATABASE [hap] SET READ_COMMITTED_SNAPSHOT OFF 
    GO
    ALTER DATABASE [hap] SET HONOR_BROKER_PRIORITY OFF 
    GO
    ALTER DATABASE [hap] SET RECOVERY SIMPLE 
    GO
    ALTER DATABASE [hap] SET  MULTI_USER 
    GO
    ALTER DATABASE [hap] SET PAGE_VERIFY CHECKSUM  
    GO
    ALTER DATABASE [hap] SET DB_CHAINING OFF 
    GO
    ALTER DATABASE [hap] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF ) 
    GO
    ALTER DATABASE [hap] SET TARGET_RECOVERY_TIME = 0 SECONDS 
    GO
    USE [hap]
    GO
    /****** Object:  User [iis apppool\hap]    Script Date: 12/06/2013 12:09:53 ******/
    CREATE USER [iis apppool\hap] FOR LOGIN [IIS APPPOOL\HAP]
    GO
    ALTER ROLE [db_owner] ADD MEMBER [iis apppool\hap]
    GO
    /****** Object:  Table [dbo].[TrackerEvents]    Script Date: 12/06/2013 12:09:53 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[TrackerEvents](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [LogonDateTime] [datetime] NOT NULL,
        [Username] [nvarchar](50) NOT NULL,
        [ComputerName] [nvarchar](50) NOT NULL,
        [LogoffDateTime] [datetime] NULL,
        [domainname] [nvarchar](50) NOT NULL,
        [ip] [nvarchar](50) NOT NULL,
        [logonserver] [nvarchar](50) NOT NULL,
        [os] [nvarchar](50) NOT NULL,
     CONSTRAINT [PK_TrackerEvents_1] PRIMARY KEY CLUSTERED 
    (
        [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY]
    
    GO
    /****** Object:  Table [dbo].[WebTrackerEvents]    Script Date: 12/06/2013 12:09:53 ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[WebTrackerEvents](
        [id] [int] IDENTITY(1,1) NOT NULL,
        [DateTime] [datetime] NOT NULL,
        [Username] [nvarchar](50) NOT NULL,
        [ComputerName] [nvarchar](50) NOT NULL,
        [EventType] [nvarchar](50) NOT NULL,
        [IP] [nvarchar](50) NOT NULL,
        [Browser] [nvarchar](50) NOT NULL,
        [OS] [nvarchar](50) NOT NULL,
        [Details] [nvarchar](max) NOT NULL,
     CONSTRAINT [PK_WebTrackerEvents_1] PRIMARY KEY CLUSTERED 
    (
        [id] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
    ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
    
    GO
    USE [master]
    GO
    ALTER DATABASE [hap] SET  READ_WRITE 
    GO

  13. #12

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    You should be able to work out, from the 1st script, the table structures

  14. #13
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    Thanks Nick,

    The first script has allowed me to import the tables. Now that I've changed the web.config and the hapconfig.xml I am greeted with the following error.

    Code:
    Server Error in '/' Application.
    --------------------------------------------------------------------------------
    
    
    Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. 
      Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
     Exception Details: System.TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
    
    Source Error: 
    
    
     An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
    
    Stack Trace: 
    
    
    
    [TypeLoadException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type) +0
       System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName) +314
       System.Type.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +95
       System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +124
       System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +76
    
    [ConfigurationErrorsException: Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.Web.Configuration.ConfigUtil.GetType(String typeName, String propertyName, ConfigurationElement configElement, XmlNode node, Boolean checkAptcaBit, Boolean ignoreCase) +11531964
       System.Web.Configuration.Common.ModulesEntry.SecureGetType(String typeName, String propertyName, ConfigurationElement configElement) +69
       System.Web.Configuration.Common.ModulesEntry..ctor(String name, String typeName, String propertyName, ConfigurationElement configElement) +62
       System.Web.HttpApplication.BuildIntegratedModuleCollection(List`1 moduleList) +264
       System.Web.HttpApplication.GetModuleCollection(IntPtr appContext) +1356
       System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +149
       System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +352
       System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +407
       System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +375
    
    [HttpException (0x80004005): Could not load type 'System.ServiceModel.Activation.HttpModule' from assembly 'System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.]
       System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +11702064
       System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +141
       System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +4870277
    I'm so sorry that I'm having so many problems.

    Regards,
    Michael

  15. #14

    nickbro's Avatar
    Join Date
    Jul 2010
    Location
    Gilwern, Wales
    Posts
    3,655
    Thank Post
    43
    Thanked 555 Times in 463 Posts
    Rep Power
    122
    Make sure the app pool is set to use ASP.net 4, it's trying to load 3.5 there

  16. #15
    linkazoid's Avatar
    Join Date
    May 2007
    Location
    London
    Posts
    655
    Thank Post
    122
    Thanked 90 Times in 74 Posts
    Rep Power
    79
    Hi Nick,

    Not sure why that happened... I used aspnet_regiis.exe -iru and that seemed to fix it.

    I'm getting there, but it's still not quite done.
    When logging in to HAP a new message is now displayed.

    Code:
    Server Error in '/HAP' Application.
    
    A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
    
    Source Error: 
    
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    
    Stack Trace: 
    
    
    [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)]
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +6351920
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +412
       System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +6366506
       System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +180
       System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +6366917
       System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +6366793
       System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +352
       System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +831
       System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +49
       System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +6368598
       System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +78
       System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +2194
       System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +89
       System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +6372110
       System.Data.SqlClient.SqlConnection.Open() +300
       System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode) +934
       HAP.Web.Login.login_Click(Object sender, EventArgs e) +620
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +155
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3707
    I've followed the following guide SQL SERVER – FIX : ERROR : (provider: Named Pipes Provider, error: 40 – Could not open a connection to SQL Server) (Microsoft SQL Server, Error: ) | Journey to SQL Authority with Pinal Dave but that's not helped.

    Regards,

    Michael



SHARE:
+ Post New Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Installing/Copying Fonts from Login Script
    By mattpant in forum Windows
    Replies: 10
    Last Post: 11th August 2011, 10:24 PM
  2. CUPS login
    By CyberNerd in forum *nix
    Replies: 6
    Last Post: 4th April 2006, 03:28 PM
  3. Login script problem
    By SpuffMonkey in forum Windows
    Replies: 55
    Last Post: 4th February 2006, 10:27 PM
  4. WSUS + Client Login....
    By techie in forum Wireless Networks
    Replies: 6
    Last Post: 1st February 2006, 10:28 AM
  5. Slow Login Problems
    By british-wave in forum Windows
    Replies: 16
    Last Post: 8th September 2005, 12:45 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •