Hi,
I'm writing a second user login for our website. I have a login page which
sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID;
Session.Add("isAuthenticated",true);
System.Diagnostics.Debug.WriteLine("UserID:"+
Session["UserID"].ToString()); // works
Response.Redirect(ReturnURL);
However, in the return page the value becomes null
try
{
Response.Write("isAuthenticated:" + Session["UserID"].ToString() +
"<br>");
}
catch
{
Response.Write("isAuthenticated is empty<br>");
}
Any suggestions?
Thanks
Maz 5 5093
Hi,
Do you use a cookie-based session? Does the client system has cookies
enabled?
--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:u6********************@rogers.com... Hi,
I'm writing a second user login for our website. I have a login page which sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID; Session.Add("isAuthenticated",true); System.Diagnostics.Debug.WriteLine("UserID:"+ Session["UserID"].ToString()); // works Response.Redirect(ReturnURL);
However, in the return page the value becomes null try { Response.Write("isAuthenticated:" + Session["UserID"].ToString() + "<br>"); } catch { Response.Write("isAuthenticated is empty<br>"); }
Any suggestions?
Thanks Maz
Maziar,
Do you have the session state turned on in the web.config file for the
app?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:u6********************@rogers.com... Hi,
I'm writing a second user login for our website. I have a login page which sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID; Session.Add("isAuthenticated",true); System.Diagnostics.Debug.WriteLine("UserID:"+ Session["UserID"].ToString()); // works Response.Redirect(ReturnURL);
However, in the return page the value becomes null try { Response.Write("isAuthenticated:" + Session["UserID"].ToString() + "<br>"); } catch { Response.Write("isAuthenticated is empty<br>"); }
Any suggestions?
Thanks Maz
Yes, it works for other parts of the application. Just this part.
Thanks
Maz.
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:ex**************@TK2MSFTNGP09.phx.gbl... Maziar,
Do you have the session state turned on in the web.config file for the app?
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"Maziar Aflatoun" <ma***@rogers.com> wrote in message news:u6********************@rogers.com... Hi,
I'm writing a second user login for our website. I have a login page which sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID; Session.Add("isAuthenticated",true); System.Diagnostics.Debug.WriteLine("UserID:"+ Session["UserID"].ToString()); // works Response.Redirect(ReturnURL);
However, in the return page the value becomes null try { Response.Write("isAuthenticated:" + Session["UserID"].ToString() + "<br>"); } catch { Response.Write("isAuthenticated is empty<br>"); }
Any suggestions?
Thanks Maz
BTW, if I remove Response.Redirect(ReturnURL) line and go to the requested
page directly by typing it in my browser, it works fine. So I guess it's the
response.redirect that's causing it. Any idea?
"Maziar Aflatoun" <ma***@rogers.com> wrote in message
news:u6********************@rogers.com... Hi,
I'm writing a second user login for our website. I have a login page which sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID; Session.Add("isAuthenticated",true); System.Diagnostics.Debug.WriteLine("UserID:"+ Session["UserID"].ToString()); // works Response.Redirect(ReturnURL);
However, in the return page the value becomes null try { Response.Write("isAuthenticated:" + Session["UserID"].ToString() + "<br>"); } catch { Response.Write("isAuthenticated is empty<br>"); }
Any suggestions?
Thanks Maz
Maziar,
¿The return URL points to a page that belongs to the same application than
the current page?
Regards - Octavio
"Maziar Aflatoun" <ma***@rogers.com> escribió en el mensaje
news:46********************@rogers.com... BTW, if I remove Response.Redirect(ReturnURL) line and go to the requested page directly by typing it in my browser, it works fine. So I guess it's the response.redirect that's causing it. Any idea?
"Maziar Aflatoun" <ma***@rogers.com> wrote in message news:u6********************@rogers.com... Hi,
I'm writing a second user login for our website. I have a login page which sets a session value and redirects the user back.
I have the following in the login page.
Session["UserID"]=UserID; Session.Add("isAuthenticated",true); System.Diagnostics.Debug.WriteLine("UserID:"+ Session["UserID"].ToString()); // works Response.Redirect(ReturnURL);
However, in the return page the value becomes null try { Response.Write("isAuthenticated:" + Session["UserID"].ToString() + "<br>"); } catch { Response.Write("isAuthenticated is empty<br>"); }
Any suggestions?
Thanks Maz
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Rene van Hoek |
last post by:
Hi,
I am using Xalan 1.8.0 and Xerces 2.6.0 in C++.
I have an XML document which I first transform into an other XML
document using an XSL styelsheet. Then I want to parse with
XPathEvaluator...
|
by: Suresh |
last post by:
Hi,
I have an C# CSEXE.exe (CSexe.cs) and a CSDll.dll
(CSdll.cs). exe is compiled with a reference to dll.
Calling for the class Type defined in CSDLL.dll using
Type.GetType(...
|
by: Jeff Adams |
last post by:
I am using MSVC .NET to create a C program. I am having trouble creating a
window. The createwindow returns NULL however no error is caught. The
GetLastError() returns "operation completed...
|
by: lydia sista via DotNetMonster.com |
last post by:
HI all how dya check if session is null or does not exist?
I tried using
if Session("cart")= null then
...
end if
this doesn't work it says 'null' is not declared. 'null' constant is no...
|
by: Zean Smith |
last post by:
I am trying to get my C# client to connect to a 3rd Perl Web Service (SOAP
Lite), this is the code that fails
......
object results = this.Invoke("getGrossData", new object {week} );
return...
|
by: MLH |
last post by:
I have 2 lines in a procedure that assign MyVariant a value - line
#238 and line #491. When line #238 runs, the value is 152. When line
#491 runs, the DLookup function returns Null. I would expect...
|
by: js |
last post by:
I am using the following C# code and T-SQL to get result object from a
SQL Server database. When my application runs, the ExecuteScalar
returns "10/24/2006 2:00:00 PM" if inserting a duplicated...
|
by: Dave |
last post by:
After some digging, I discovered HttpContext.Current.Session is null
when trying to access a session variable, username, in my upload.cs
code which is in the App_Code folder.
I just determined...
|
by: Peter Michaux |
last post by:
Suppose I have implemented a language with garbage collection in C. I
have wrapped malloc in my own C function. If malloc returns NULL then
I can run the garbage collector and then try malloc...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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...
| |