473,408 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Response.Redirect problem

I am having a strange problem that I cannot solve. I have an asp page that I use for a user to login and gain access to other pages. When the user logs in I set a couple of session variables like Session("UserType") = "Sales". Then based on the Session("UserType") I use response.redirect to take the user to a specific page. The logic and response.redirect works fine on a Win2k server but when I move the page to a server running Win2003 the response.redirect does not work even though the session variables are being set correctly. I can use response.write session("UserType") to see that it is set to "Sales" yet the response.redirect logic will not redirect to the page I want. The user is always redirected to the default page at the bottom of the If statements I am using. Can anyone tell me what might be causing this? Thanks
Jul 19 '05 #1
3 2790
You are losing your session variables
There are a bunch of us that are having the same problem
You will find that the session variables are gone and you run the
session_onstart at every page.
Jul 19 '05 #2
Is this just some session variables? I am using the same variable at the top of every page to verify that the user has logged in and if the variable is empty then I redirect to the login page - all of that still works fine.
Jul 19 '05 #3
I set up several pages to work with sessions on both IIS5 (W2K) and IIS6 (W2K3). It appears that both work the same. Sessions variables
remain intact until the session times out or all the IE browsers on the client machine are shutdown. I think Opera browser create a new
session for each instance of a connection to IIS (I'll have to check this)

Other things that can cause session variables to reset is touching the Global.asa file which makes IIS think it needs to recycle all the
sessions. I've included the test files below, and would like to hear from anyone with different results.

global.asa << include the Session_OnStart into your Global.asa, this set's an initial session variable
Session1.asp << This sets some session variables and redirects to Session2
Session2.asp << this Writes the session variables and a form. The button actions Session3.asp
Session3.asp << This writes the session variables and on button push, goes to Session1.asp which redirects to Session2

The session variable called LoopTick (Initially set by global.asa) contains a hostory fo the session pages being accessed.


Global.asa
===========
<SCRIPT LANGUAGE=VBScript RUNAT=Server>
Sub Session_OnStart()
Session( "LoopTick" ) = "SessionStarted" & now & " >"
End Sub
</SCRIPT>

Session1.asp
===============
<HTML>
<body>
<%

Response.write( "<br>In Session1.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "1"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )
Session( "able" ) = "Sess1-1"
Session( "baker" ) = "Sess1-2"

Response.redirect( "Session2.asp" )

%>
</body>
</HTML>
Session2.asp
============

<HTML>
<body>
<%
Response.write( "<br>In Session2.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "2"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )

Response.write( "<br>Able=" & Session( "able" ) )
Response.write( "<br>Baker=" & Session( "baker" ) )

Response.write( "<br>Resetting Session variables" )
Session( "able" ) = "Sess2-1"
Session( "baker" ) = "Sess2-2"
Response.flush()
%>
<Form method="POST" name="MyForm" ACTION="Session3.asp" >
<INPUT TYPE=Submit VALUE="Goto Session3 page ">
</FORM>

</body>
</HTML>


Session3.asp
=============
<HTML>
<body>
<%

Response.write( "<br>In Session3.asp " )
Session( "LoopTick" ) = Session( "LoopTick" ) + "3"
Response.write( "<br>LoopTick=" & Session( "LoopTick" ) )

Response.write( "<br>Able=" & Session( "able" ) )
Response.write( "<br>Baker=" & Session( "baker" ) )

Response.write( "<br>Resetting Session variables" )
Session( "able" ) = "Sess3-1"
Session( "baker" ) = "Sess3-2"
Response.flush()
%>
<Form method="POST" name="MyForm" ACTION="Session1.asp" >
<INPUT TYPE=Submit VALUE="Goto Session1 page ">
</FORM>

</body>
</HTML>

-rwg
This is what I think, not necessarily what is accurate!

--------------------
| Thread-Topic: Response.Redirect problem
| thread-index: AcQC/3V1r2KDKS2tQJCASKwLMzYQZg==
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
| From: "=?Utf-8?B?TGFuc2U=?=" <an*******@discussions.microsoft.com>
| References: <3B**********************************@microsoft.co m>
| Subject: RE: Response.Redirect problem
| Date: Fri, 5 Mar 2004 14:16:08 -0800
| Lines: 4
| Message-ID: <02**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.inetserver.asp.general
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.inetserver.asp.general:267636
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
|
| You are losing your session variables

There are a bunch of us that are having the same problem

You will find that the session variables are gone and you run the

session_onstart at every page.
|
Jul 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Paul | last post by:
I'm not getting the results I want when I use Response.Redirct in a ASP page. I enter this line of code in a asp page from domain1.com. Response.Redirect...
4
by: TomT | last post by:
Hi.. I'm redirecting users to another page using: response.redirect("newpage.asp") this works... But I need to add a variable to the page specified.. IE: newpage.asp?id=JobID
6
by: Sam | last post by:
I have some issues with HTTP Headers and I was hoping for some pointers or references to good articles. Here is the problem. I have 6 .aspx pages, each page contains a common .ascx. This ascx...
2
by: news://news.microsoft.com/microsoft.public.de.germ | last post by:
Hallo! Ich habe ein Frameset mit 3 Frames. Im 1. Frame wird eine ASPX-Seite geöffnet. In dieser werden einige Steuerelemente angezeigt. Nun soll bei bestimmten Benutzeraktivitäten eine andere...
1
by: Sean Wolfe | last post by:
I have this wierd bizarrre problem that I'm experienceing with the Response.Redirect() method. I have a site where the users are on a particular page in SSL. When they post the data back, and...
5
by: venner | last post by:
I'm having an issue with an ASP.NET website after upgrading to ASP.NET 2.0. The website makes use of a central authentication service (CAS) provided at the university I work for. Each page checks...
4
by: mike.biang | last post by:
I have an ASP page that is using an XMLHTTP object to request various pages from my server. I keep a single session throughout the XMLHTTP requests by bassing the ASPSESSIONID cookie through the...
12
by: gigi | last post by:
How to send more than one value using response redirect? For example i can send one like this response.Redirect "pregled.asp?ime=" & strUserName but how to send two or more values? I tried...
5
by: =?Utf-8?B?d2ViZ3V5QGNvbW11bml0eS5ub3NwYW0=?= | last post by:
We have been running into some problems where using Response.Redirect causes the page to hang and it never actually redirects. Here's the scenario: User opens the page, selects an item from the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.