Forum Moderators: open
I currently have a schools ICT Intranet support site designed by another individual who unfortuantly no longer works for the school, we have no ASP experts here, and my knowledge is what ive picked up as ive gone along.
The site currently resides on a Windows 2003 Server Microsoft IIS, connecting to SQL Server 2000 for the database entries works ok on the current server.
Now this server is abit dated so i planned to move it all over to the new server. Nearly the same setup Server 2003, Microsoft IIS and Sql Server 2005 being the only main change.
First off i wanted to just move the Webs stuff, leave the SQL Servers in place for now and migrate them over later. However this isnt working to plan. I setup the ODBC to connect to the old server tested it all works fine from that end.
However i run the pages and goto logon i get the following error.
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'RIGHT'
/NewIndex.asp, line 20
Which looks like this Line 20 being in bold
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/Support_Database.asp" -->
<%
Dim MyUser
MyUser = Request.ServerVariables("AUTH_USER")
Session("SupportUser") = MyUser
DIM iMonth
iMonth = Month(now)
Session("RequestMonth") = iMonth
Dim MyEmail
Dim MyLength
MyLength = len(MyUser)
Session("Count") = (MyLength - 9)
MyLength = Session("Count")
MyEmail = RIGHT(MyUser,MyLength)
Session("SupportEmail") = MyEmail &"@domain.domain.sch.uk"
Dim MyDate
MyDate = Date()
Session("SupportDate") = MyDate
Dim MyTime
MyTime = Time()
Session("SupportTime") = MyTime
Dim Users__MMColParam
Users__MMColParam = "1"
If (Session("SupportUser") <> "") Then
Users__MMColParam = Session("SupportUser")
End If
%>
<%
Dim Users
Dim Users_numRows
Dim CurrentUser
Set Users = Server.CreateObject("ADODB.Recordset")
Users.ActiveConnection = MM_Support_Database_STRING
Users.Source = "SELECT * FROM dbo.Users WHERE Username = '" + Replace(UCASE(Users__MMColParam), "'", "''") + "'"
'Users.Source = "SELECT * FROM dbo.Users"
Users.CursorType = 0
Users.CursorLocation = 2
Users.LockType = 1
Users.Open()
If Not Users.EOF Then
' User has associated record in database
'Response.Redirect("Intranet.asp")
Response.Redirect("Intranet.asp")
Else
' User is not known - redirect to help page
'Response.Write "Bad"
Response.Redirect("UnAuthorised.asp")
End If
'Users_NumRows = 0
'Do While Not Users.EOF
'Users_NumRows = Users_NumRows + 1
'Users.MoveNext
'Loop
'
'If Users_NumRows = 0 Then Response.Write ("You are not known in the database")
'If Users_NumRows = 1 Then
'SESSION("Auth") = TRUE
'Response.Write ("You ARE known in the database")
'End If
'If Users_NumRows > 1 Then Response.Write ("Error : To many records returned")
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
</body>
</html>
<%
Users.Close()
Set Users = Nothing
%>
Now ive looked up this and it refers to Null database entries but i cant see how this is relivant as it currently works on currently live old server! only thing i can think of is that its not pickign up the info off the sql server but im lost! any help would be great.
My first assumption is that Request.ServerVariables("AUTH_USER") is returning a empty or null value, and causing the issues you described. I think you didn't setup the authentication the same way it was setup on the old server which is what is causing your problem.
MyUser = Request.ServerVariables("AUTH_USER")
MyLength = len(MyUser)
MyEmail = RIGHT(MyUser,MyLength)
The Right function requires MyLength variable to be positive integer greater then zero.
Related Links:
Visual Basic Scripting Edition:
Right Function [msdn2.microsoft.com]
IIS Server Variables:
AUTH_USER [msdn2.microsoft.com]
The name of the user as it is derived from the authorization header sent by the client, before the user name is mapped to a Windows account. This variable is no different from REMOTE_USER. If you have an authentication filter installed on your Web server that maps incoming users to accounts, use LOGON_USER to view the mapped user name.
[edited by: Ocean10000 at 8:28 pm (utc) on Dec. 10, 2007]