Hi guys, I just want to consult something and this has been my problem for almost half a year, wheoooo...
Here's the situation, we have an existing intranet application for HRD. It uses session and database login authentication and it is working properly in the existing web server (fyi, i was not the one who developed the application but the coding was simple), now I was tasked to transfer the application to another server that will act as the new web server.
Here are the important codes for the initial asp pages:
1. main.asp - has the form action
<form name="form1" method="post" action="verify.asp">
2. verify.asp - has the db connection,
id = Request.form("employeeid")
pwd = Request.form("password")
session("employeeid") = id
if id = "" or pwd = "" then
Response.redirect invalid_page
else
end if
set my_conn= Server.CreateObject("ADODB.Connection")
my_conn.Open"EmpLeave"
set rscheck = my_conn.Execute ("Select * from Employee where EmpID='" & id & "' and Password='" & pwd & "'")
if rscheck.eof then
rscheck.Close
my_conn.Close
Response.redirect invalid_page
'invalid password and redirect to error.asp
else
session("employeeid") = rscheck("EmpID")
session("name") = rscheck("NickName")
session("fullname") = rscheck("FirstName") session("password") = rscheck("Password")
end if
Response.redirect "home.asp"
end if
***some session and other unnecessary codes for explanation are ommitted.
3. home.asp
If session("employeeid") = "" Then
Response.Redirect "mainend.asp"
Else
End If
Now, I just copied the files in the wwwroot of the specified new web server and set the configurations in IIS (e.g. session properties) and ODBC connections...
All I have to do is to check if it works properly and since I first checked or browsed the web application in internet explorer in the old server, it works! session is working alright... But when i tried checking or browsing it in other pc's ( in internet explorer), session is not working. What makes it worst is that session is not also working when I tried to browse it in the new web server ( in internet explorer). It is very confusing since it is working or the session is working in the old web server (in internet explorer, as client pc since the files are pointed to the new web server) but it is not working in other pc's and most especially in the new web server.
I've tried configuring the necessary configurations in IIS (application configuration - enable session state), Internet Explorer (cookies setting), global.asa (default codes), but still it is not working (I've read resources and advices from this article from microsoft, http://support.microsoft.com/default...b;EN-US;175662).
Our last resort was to reformat the web server and install default configuration for IIS and others, and to no avail, it's still not working.
I would really appreciate any advice and help since this problem is giving me lots of headaches and I'm in the process of developing other applications with database login authentications using session. What are my options, can I use request.querystring instead?
First of all, try assigning a literal value to the Session variable.
Code:
Session("employeeid") = "test"
' If this does not work, try: If Session("employeeid") = "" Then ...
If IsEmpty(Session("employeeid")) Then
Response.Write("Damn! This is a problem")
Else
Response.Write("Value: " & Session("employeeid"))
End If
If that works, then the problem lies on the referring page and Request.Form("employeeid") does not contain a value.
If IsEmpty(Session("employeeid")) Then
'If this does not work, try:
'If Session("employeeid") = "" Then
Response.Write("Damn! This is a problem")
Else
Response.Write("Value: " & Session("employeeid"))
End If
%>
Yes Andrew, I've tried both and indeed session is working. Now you are definitely right in saying that "the problem lies on the referring page and Request.Form("employeeid") does not contain a value". Now how do resolve that. What changes should I apply in the "verify.asp" page which originally contains the script below in the first thread. Thanks Andrew
If session("employeeid") = "" Then
Response.Redirect "mainend.asp"
Else
Response.Write("Value: " & Session("employeeid"))
End If
By the way, I tested the codes you gave me just to confirm if session is working alright in the new server, when I tried to browse for the application in Internet explorer in the old server, it does shows the session (Value: 6745-3, which is the format of the employee id), but when I tried to browse for the application in Internet explorer in the new server and at least 4 other client pc's, I am still being redirected to mainend.asp.
How can this actually happen if what I'm supposed to do is just to copy the files main.asp, verify.asp and home.asp (fyi:functions of respective asp files in initial thread) from the old server to the new server since they are the same files and were supposed to work and function alike from the old server to the new server. One more thing, there were cases before that it was working already in the new server but after an hour or a day when I will check it again, it doesn't work again. I can't really figure it out. Please help Andrew and others who might have an idea why this is happening.
The problem may lie in the configuration of the server. The new server may be setup to not accept Session variables. Also, your browser must accept cookies for Sessions to work.
Go to Internet Options in IE and ensure that your browser accepts cookies.
Bookmarks