473,480 Members | 2,271 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Session Variables Not Saved

Hey All,
Using C# with ASP.NET 1.1 and I've noticed an issue on my system
running pages that save data to the session object. I've got a login
page that after you login and are verified it will store the username
to the session then do a redirect to the default page:

private void btnLogin_Click(object sender, System.EventArgs e)
{
WebValidationWebService.WebValidation wv = new
WebValidationWebService.WebValidation();
bool valid = wv.CheckLogin(this.txtUserName.Text,
this.txtPassword.Text);
// they are using a valid login
if(valid)
{

this.SetUserName(this.txtUserName.Text);
Response.Redirect("default.aspx", true);
}
}

//located in the base class of the form
protected virtual void SetUserName(string UserName)
{//SESSIONKEY_USERNAME is a string const
Session.Add(SESSIONKEY_USERNAME, UserName);
}

seems then I click login it validates properly and redirects me, the
problem is when I hit the default page the username in the session is
gone. I've noticed the session_start event does get fired multiple
times but I cannot figure out why. The only way I can get sessions to
work is change the web.config to cookieless:

<authentication mode="Forms">
<forms name="TradeEntryCookie" loginUrl="login.aspx" protection="All"
path="/" />
</authentication>

.. . . .
<sessionState
mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
sqlConnectionString="data
source=127.0.0.1;Trusted_Connection=yes"
cookieless="true"
timeout="20"
/>

Any Suggestions?

Jan 30 '06 #1
0 1009

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

Similar topics

9
2972
by: Xizor | last post by:
Let's say I run a server. I have two people using the server. Bill and Joe. Bill is at address.com/bill and Joe is at address.com/joe. Let's say Joe and Bill are both using PHP with sessions on...
3
5944
by: M Wells | last post by:
Hi All, Just wondering how you go about changing the value of a session cookie via javascript? I have a PHP page that sets a session cookie when it first loads. I'd like to be able to change...
0
1303
by: Jack | last post by:
Hi, I have the following problem. I have a main data entry form which has a link to a detailed data entry form. The value of the link in the main form is the sum total of all the line items...
5
2428
by: Abhilash.k.m | last post by:
This is regarding the session management using Out of proc session management(SQL SERVER). Among the samples below which one is better to set the session? 1. There are 20 session...
2
2369
by: Boban Dragojlovic | last post by:
I'm building a complex web-based reservations system. Gathering the user's data requires between 8 and 15 pages (depending on which options they are interested in). I use the "Session" object to...
5
548
by: Sean | last post by:
Problem with sessions I have created an application without concern for sessions. As it turns out I think that might be my undoing. What I have: I have an online quiz. I don’t need to know...
14
2161
by: Coleen | last post by:
Hi All :-) We have an APSX application using VB.net as the code behind, which uses one or two session variables per page. These Session variables are passed to the final page and calculations...
1
1584
by: Tom | last post by:
I've been researching this for a while now -- perhaps someone here knows the explanation. I uploaded to my remote host (system info: PHP Version 4.3.11, FreeBSD metis.cleverdot.com...
3
2663
by: Phillip N Rounds | last post by:
I'm writing a user control which has two states: Active & InActive. I additionally am required that there to be only one active control per page, and all logic has to be contained within the...
0
6911
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...
1
6743
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...
0
6966
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
5344
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
4488
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...
0
2999
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...
0
2988
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1303
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
564
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.