I use the following code to set a session variable for people I have
authenticated to my site:
For Each row As DataRow In foundRow
Session("Login" ) = row.Item(1).ToS tring
Exit For
Next
Response.Redire ct(Request.Quer yString("PageID "))
The Session("Login" ) get set just fine, but when I do the redirect the page
that loads checks for the following:
If Session("Login" ) = "" OrElse IsNothing(Sessi on("Login")) Then
Response.Redire ct("Login.aspx? PageID=" & Request.Path)
Else
Label1.Text &= " " & Session("Login" ).ToString
End If
When I check the session variable here, it is empty. Does anyone know why?
John 4 1491
where are you putting the code Session("Login" ) = row.Item(1).ToS tring
why a for loop for executing only once?
are you within the same domain?
are you within asp.net always?
Lit
"John Wright" <ri***********@ hotmail.comwrot e in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I use the following code to set a session variable for people I have authenticate d to my site:
For Each row As DataRow In foundRow
Session("Login" ) = row.Item(1).ToS tring
Exit For
Next
Response.Redire ct(Request.Quer yString("PageID "))
The Session("Login" ) get set just fine, but when I do the redirect the
page that loads checks for the following:
If Session("Login" ) = "" OrElse IsNothing(Sessi on("Login")) Then
Response.Redire ct("Login.aspx? PageID=" & Request.Path)
Else
Label1.Text &= " " & Session("Login" ).ToString
End If
When I check the session variable here, it is empty. Does anyone know
why?
John
Fixed it. It has to deal with the Response.Redirc t. I needed to overload
it so it reads:
Response.Redire ct(Request.Quer yString("PageID "),false)
This takes care of it.
"Lit" <sq**********@h otmail.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
where are you putting the code Session("Login" ) = row.Item(1).ToS tring
why a for loop for executing only once?
are you within the same domain?
are you within asp.net always?
Lit
"John Wright" <ri***********@ hotmail.comwrot e in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>>I use the following code to set a session variable for people I have authenticat ed to my site:
For Each row As DataRow In foundRow
Session("Login ") = row.Item(1).ToS tring
Exit For
Next
Response.Redir ect(Request.Que ryString("PageI D")) The Session("Login" ) get set just fine, but when I do the redirect the page that loads checks for the following: If Session("Login" ) = "" OrElse IsNothing(Sessi on("Login")) Then
Response.Redir ect("Login.aspx ?PageID=" & Request.Path)
Else
Label1.Text &= " " & Session("Login" ).ToString
End If When I check the session variable here, it is empty. Does anyone know why? John
John,
This does not make any sense to me. I tried your code and it works fine on
my end. the session has the correct info picked from the second page.
Response.Redire ct(Request.Quer yString("PageID "),false)
the Boolean parameter, indicates whether execution of the current page
should terminate.
I hope you are right and explain why it works that way or someone else can
explain this.
Thank you,
Lit
"John Wright" <ri***********@ hotmail.comwrot e in message
news:Oa******** ******@TK2MSFTN GP05.phx.gbl...
Fixed it. It has to deal with the Response.Redirc t. I needed to overload
it so it reads:
Response.Redire ct(Request.Quer yString("PageID "),false)
This takes care of it.
"Lit" <sq**********@h otmail.comwrote in message
news:%2******** ********@TK2MSF TNGP06.phx.gbl. ..
>where are you putting the code Session("Login" ) = row.Item(1).ToS tring why a for loop for executing only once? are you within the same domain? are you within asp.net always?
Lit
"John Wright" <ri***********@ hotmail.comwrot e in message news:%2******* *********@TK2MS FTNGP05.phx.gbl ...
>>>I use the following code to set a session variable for people I have authenticate d to my site:
For Each row As DataRow In foundRow
Session("Logi n") = row.Item(1).ToS tring
Exit For
Next
Response.Redi rect(Request.Qu eryString("Page ID")) The Session("Login" ) get set just fine, but when I do the redirect the page that loads checks for the following: If Session("Login" ) = "" OrElse IsNothing(Sessi on("Login")) Then
Response.Redi rect("Login.asp x?PageID=" & Request.Path)
Else
Label1.Text &= " " & Session("Login" ).ToString
End If When I check the session variable here, it is empty. Does anyone know why? John
John Wright wrote:
Fixed it. It has to deal with the Response.Redirc t. I needed to overload
it so it reads:
Response.Redire ct(Request.Quer yString("PageID "),false)
This takes care of it.
No, it doesn't. The only difference is that the execution of the code
doesn't end there, but continues to run the rest of the code. As that
doesn't change how session variables work, there has to be something in
the code below that makes a difference.
Do you set the session variable elsewhere in the code?
The Redirect method normally uses an exception to end the execution. Do
you have any error handling that catches exceptions that it shouldn't?
--
Göran Andersson
_____ http://www.guffa.com This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: doltharz |
last post by:
Please Help me
i'm doing something i though was to be REALLY EASY but it drives me
crazy
The complete code is at the end of the email
(i mean newsgroup article),
i always use Option Explicit
and Response.Expires=-1,
|
by: Ann Leland |
last post by:
I have been using session variables to pass a user name from one ASP
page to another inside framesets for 9 months and it stopped working
this week. I have made no code changes but there was a "security
update" installed on the server a few days ago but I can't find out
exactly what it was.
In the research I have done I found many articles on the subject of
session variables in ASP pages inside framesets. From what I read a
new...
|
by: VB Programmer |
last post by:
If I have a variable I want to share in my application what is the
difference between just declaring a variable (Dim strMyVar as String) and
using a session variable (Session("strMyVar"))?
When should I use a session variable and when should I just declare it like
normal?
Thanks in advance!
|
by: Mark Rodrigues |
last post by:
Hi Everyone,
I have been fighting a problem for a while and I wonder if someone out
there can help.
This problem has been presented in a number of news postings
previously but I am yet to see a response with a suitable resolution.
So here goes ...
We have a web site which stores an instance of a class into a Session,
which is used in a number of pages. The code looks something like:
|
by: Greg Linwood |
last post by:
I'm having difficulty understanding Session state in ASP.Net. It's almost
embarrassing asking this as I've been using ASP since it was first released
& it really shouldn't be this hard to use - perhaps I'm just not very smart
or perhaps MS is making this too hard for us sql bunnies to understand - I
dunno, but I'd really appreciate someone explaining what I'm doing wrong
here & perhaps suggest a better approach..
I'm familiar with use of...
| |
by: T Ralya |
last post by:
I am told that ASP.NET controls the session ID and session variables, but
that does not fit my symptoms. I am posting here as directed. I'm hoping
that someone can at least recommend something to try to isolate the problem.
I have a simple application that demonstrates my problem.
Page 1, step1: SaveSessionVariableButton will create a string value, show
it on screen, save it in a session variable and show the session ID on screen....
|
by: Alan Wang |
last post by:
Hi there,
Once my application gets complicated and complicated. I found it's really
hard to keep track of Session value I am using in my asp.net application. I
am just wondering if anyone have any experience on how to keep track of
session value. Any help it's appreciated.
Thanks
Alan
|
by: Don Miller |
last post by:
I am using a Session variable to hold a class object between ASP.NET pages
(in VB). In my constructor I check to see if the Session variable exists,
and if it doesn't, I create one and populate it with "Me". But if the
Session variable already exists, I would like the new object be populated
with everything from the object stored in the Session variable. Ideally, I'd
like to retrieve the object from the Session variable and assign it to...
|
by: Control Freq |
last post by:
Hi,
Not sure if this is the right NG for this, but, is there a convention
for the variable names of a Session variable?
I am using .NET 2.0 in C#. I am new to all this .NET stuff, So, any
guidance appreciated.
Regards
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |