• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 262
  • Last Modified:

Using ASP Session objects on Windows 2003 server to pass data between pages

I need to move existing ASP application from Windows NT server to Windows 2003 server.
The applications uses Session objects and "response.redirrect" to pass data between pages.  However on Windows 2003 server the receiving page does not get anything from session("my_key_name").  It just contains an empty string.

What settings or changes should be applied to allow the usage of session objects on the Win 2003 server and to get the application working?

Any suggestions will be greatly appreciated.

Thank you
0
pavelmed
Asked:
pavelmed
  • 13
  • 9
  • 3
  • +1
1 Solution
 
AgentSmith007Commented:
If you look @ Web Service Extensions under IIS, is ASP allowed? Is there anything in there that is not allowed that might affect this?
0
 
pavelmedAuthor Commented:
Active Server Pages are allowed @ Web Service Extensions.
In fact, there are other ASP applications that run on that server.  They just don't use sessions.

I also noticed another weird thing:
It does not allow the usage of #include file="../directory/file.asp

The following line:
<!--#include file="../mydir/proper.asp"--> causes the the error message :
"Active Server Pages error 'ASP 0131'
Disallowed Parent Path
The Include file '../components/adovbs.inc' cannot contain '..' to indicate the parent directory."

The page runs fine on Windows NT.

Thank you.
0
 
AgentSmith007Commented:
For the include, you can use #include virtual="[path relative to web server root]" ...i'm not sure why the other is causing an issue...
stilling looking for a solution on that one...seems odd that it doesn't work out of the box...it should
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
pavelmedAuthor Commented:
Yes, I understand that I can use "#include virtual=full_path" instead.  I alreadyb tested, and it worked.
But the other one should work as well...
It would just require a lot of pages to modify.
But the main question is about using sessions.  Why can't I retrieve data?

Thanks.
0
 
fritz_the_blankCommented:
I ran into that exact same path problem the other day when I migrated from NT 4.0 to Server 2003. Here is the fix for that at least:

http://support.microsoft.com/default.aspx?scid=kb;en-us;332117

WORKAROUND
To resolve this problem without changing the application: 1. Click Start, click Administrative Tools, and then click Internet Information Services (IIS) Manager.
2. Double-click your computer name in the left pane, and then double-click Web Sites.
3. Locate the Web site and directory that houses the ASP application.
4. Right-click the application site or directory, and then click Properties.
5. Select Home Directory, and then click Configuration.
6. Click Options, and then click to select the Enable Parent Paths check box.
7. Click OK two times.

FtB
0
 
pavelmedAuthor Commented:
Fritz the Blank,
Thank you very much for your suggestion.  It solved the #include file problem.

But the application still can't retrieve the value of session's varables.  
The applications uses Session objects and "response.redirrect" to pass data between pages.  However on Windows 2003 server the receiving page does not get anything from session("my_key_name").  It just contains an empty string.

This is the major problem that I need to resolve to avoid re-writing the application.  Could you please suggest?

Thank you.
0
 
pavelmedAuthor Commented:
I noticed one more thing:
I checked the SessionID property on the page that redirects to another page and on the receiving page.
And the values are different.  Close but different.  Does it mean that Win 2003 does not maintain the session between ASP pages?  Or, again, should some settings be applied to maintain the same session?

Thank you.
0
 
fritz_the_blankCommented:
Let's start with something simple outside of your application for testing purposes. Please run these two pages and then let me kow if you can use session variables in this simple way. If so, we can move on to the next step. Otherwise, we know where to begin looking.

********
Page1.asp
********

<%
dim strFirst, strLast
Session("strFirst") = "Bugs"
Session("strLast") = "Bunny"
%>

********
Page2.asp
********

<%
response.write(Session("strFirst") & " " & Session("strLast")
%>





0
 
pavelmedAuthor Commented:
Ok, there is some progress.
If the pages are in the same directory, it works.  I tried your code and then I added Response.redirrect just in case and called just the Page1- it worked.
But then I moved the page2 to another directory which is set as another virtual directory in the IIS Manager and used Response.redirrect for this setting - and it did not work.  I mean, the values are blanks.

It is not my design, it's the way it was set on the Windows NT, and this second directory is actually used by several applications, so I need to preserve this layout.  Hope that there is a solution.  Please suggest.

Thank you.
0
 
fritz_the_blankCommented:
Okay, I had a feeling something like this was going on....

How do these pages relate to each other? In otherwords, this will work:

www.YourSite.com/Page1.asp
www.YourSite.com/Page2.asp

This will not:

www.YourSite1.com/Page1.asp
www.YourSite2.com/Page2.asp

FtB
0
 
pavelmedAuthor Commented:
It's case #1.
Both virtual directories are under the Default Web Site.
So In IIS, I have
Default Web Site
       Dir1
       Dir2

In the code, I have
********
Page1.asp (on Dir1)
********
<%
dim strFirst, strLast
Session("strFirst") = "Bugs"
Session("strLast") = "Bunny"
Response.Redirect("/Dir2/Page2.asp")
%>

********
Page2.asp (on Dir2)
********

<%
response.write(Session("strFirst") & "__" & Session("strLast")
%>

It works on NT but not on Win 2003 so far.

Thank you.
0
 
fritz_the_blankCommented:
So to make sure that I understand, you have something like this?

www.YourSite.com/Directory1/somepage.asp
www.YourSite.co/Driectory2/someotherpage.asp

and this does not work?

FtB
0
 
pavelmedAuthor Commented:
Yes, this is correct.
0
 
fritz_the_blankCommented:
Okay. Are you sure that you are landing on the correct page with the redirect?

Also, what are the results of this if you put it on the second page?

               for each objItem in Session.Contents
                    response.write(objItem & ": " & Session.Contents(objItem) & "<br>")
               next
 
FtB
0
 
pavelmedAuthor Commented:
Answer on the Q1:
I have "__" between two values:
response.write(Session("strFirst") & "__" & Session("strLast")

When the page is displayed, I see just "__" instead of Buds__Bunny
0
 
pavelmedAuthor Commented:
Answer on the Q2:
I placed your code on the second page - it did not display anything
for each objItem in Session.Contents
       response.write(objItem & ": " & Session.Contents(objItem) & "<br>")
next

Thanks
0
 
fritz_the_blankCommented:
Okay, this definitely means that something is funky.

What happens if you run page one without the redirect, and then visit the second page? Do the sessions get written then?


FtB
0
 
pavelmedAuthor Commented:
No, sessions values are still blanks
0
 
fritz_the_blankCommented:
So, we know that session variables are working. We have also ruled out that this is a result of the redirect. So, the question becomes why this is happening! What happens if you use a Server.Transfer rather than a response.redirect?

I am sorry for the silly questions, but I am at something of a loss here.

FtB
0
 
davidlars99Commented:
sorry folks, I didn't read the whole thing, I'm not even sure if anybody has already mentioned this but here it is

right click on My Computer --> Manage --> Services and Applications -->  Internet Information Services --> Default Web Site -->   right click on it --> Properties -->  Home Directory tab --> Configuration button --> App Options tab --> check all three (maybe more) boxes and put some value in Session Timeout textbox --> restart IIS and try again
0
 
pavelmedAuthor Commented:
Fritz the Blank,

Session.Transfer works!!!  It works OK on test pages.  On real pages I will need to do some modifications because I have to set the page name more explicitely than with Response.redirect, but it does pass teh session's values.
So I will end up with minor modifications instead of major ones.

Thank you very much.  I would give you 1000 points if I could.

0
 
pavelmedAuthor Commented:
davidlars99,

Thank you for the suggestion.  I tried it, and it did not work.  But it was useful anyway.
0
 
fritz_the_blankCommented:
I have no idea why this works, but I would keep an eye open...

I am glad that you are on your way for a bit.

FtB
0
 
davidlars99Commented:
asp sessions depend on cookies, did you check if cookies are enabled for the browser by which you are accessing the page..?
0
 
fritz_the_blankCommented:
@davidlars99--

This worked, so cookies are enabled:  http:#13931353

--FtB
0
 
davidlars99Commented:
one more thing

right click on My Computer --> Manage --> Services and Applications -->  Internet Information Services --> Default Web Site -->   right click on it --> Properties --> check "HTTP Keep-Alives Enable" --> restart IIS and try again
0
 
pavelmedAuthor Commented:
davidlars99,

"HTTP Keep-Alives Enable" has been checked on the server from the very beginning.

Thanks
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 13
  • 9
  • 3
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now