473,770 Members | 3,912 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Losing Session Object

Can someone tell me why I'm losing my session variable when using
Response.Redire ct? When I use the RedirectFromLog inPage method(currentl y
remmed out below), my session variable works fine, but I'm trying this
other way with Response.Redire ct and it seems all my redirection works,
but it loses the session variable when I hit the redirected pages. Help
appreciated. Thanks. Here is code:

<code>

<%@ Import Namespace="Syst em.Data.OleDB" %>

<%@ Import Namespace="Syst em.Web.Security " %>

<%@ Page Language="vb" CodeBehind="log in.aspx.vb"
AutoEventWireup ="false" Inherits="Login WithSessionVari ables.login" %>

<HTML>

<script language="VB" runat="server">

Sub Login_Click(Src As Object, E As EventArgs)

If Page.IsValid Then

Dim strConn as string ="PROVIDER=Micr osoft.Jet.OLEDB .4.0;DATA
SOURCE=" & server.mappath( "DB/WroxDBAuth.mdb" ) & ";"

Dim Conn as New OLEDBConnection (strConn)

Conn.Open()

Dim strSQL as string = "SELECT Pwd, Group FROM Tbl_MA_Users WHERE
Email = '" & txtEmail.Text & "'"

Dim Cmd as New OLEDBCommand(st rSQL,Conn)

'Create a datareader, connection object

Dim Dr as OLEDBDataReader =
Cmd.ExecuteRead er(System.Data. CommandBehavior .CloseConnectio n)

Dim strGroup As String

'Get the first row and check the password.

If Dr.Read()

If Dr("Pwd").ToStr ing = txtPwd.text Then

strGroup = Dr("Group").ToS tring

'FormsAuthentic ation.RedirectF romLoginPage(tx tEmail.Text, false)

FormsAuthentica tion.SetAuthCoo kie(txtEmail.Te xt, false)

Response.Redire ct(strGroup)

Else

lblLoginMsg.tex t = "Invalid password."

End If

Else

lblLoginMsg.tex t = "Login name not found."

End If

Dr.Close

End If

Session("UserNa me") = txtEmail.Text
End Sub
</code>

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 21 '05 #1
0 982

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

Similar topics

1
2784
by: Scott Lyon | last post by:
I'm maintaining (read: I didn't write it, nor do I have the time to spend to rewrite it) an application that is suddenly giving me grief. The reason I say suddenly, is because we're in the process of transitioning the server on which it runs from Microsoft Windows 2000 Server, to 2003 server (going from IIS 5 to IIS 6). This problem hasn't really occurred on the 2000 server machine, but it's happening MUCH more on the new 2003 box (not...
4
2171
by: Stephen | last post by:
I have a .NET (1.1 framework) application that is losing a session variable on only a few PC's. The main page is loading up in a frame in a Portal application. On the Page_Load it stores an object with the user id and password into the session. The web page includes a set of links. When the user clicks on a link, another page within this application is opened in a new window. On the Page_Load of this second page, I am retrieving...
2
6163
by: Joe Molloy | last post by:
Hi, This isn't a mission critical question but I thought I'dl throw it out there for your feedback as it's a bit curious. I have developed a shopping cart for an application I'm working on which is loosely based on the e-commerce example in the quickstarts tutorial. In the cart display I have provided functionality so that when a user clicks on a product name a popup is opened with the full product details displayed.
4
2407
by: Keith-Earl | last post by:
I have been writing ASP.NET apps since the RTM build and have never seen this. I built a simple app that uses session variables on my DEV laptop. All runs well. I have a simple toggle routine that checks the status of a Session variable. I keep losing the value of the variable. When I trace the page it is there, but it is gone next postback. Also, I use three tier objects and store my DataManager object in a session variable. It is...
5
5292
by: fbwhite | last post by:
I know this issue has been brought up many times, but I have tried many of the solutions to no avail. I wanted to give my specific case to see if someone could be of any help. We are using the sessionstate inproc mode and users are randomly losing their session. I do not believe it is happening across all users at one time. It seems to happen to different users at different times, but I am only going off heresay. The aspnet worker...
9
2547
by: Adrian Parker | last post by:
We have a website that works everywhere but on a few PCs on this one site.. Asp.Net 1.1 Server = Windows 2003 Client = XP In the web.config we use - cookieless="false" in the browser settings they have "Always allow session cookies" set to true When the browser connects to the website the first page sets a session variable called "user_ref" to something and then calls another page. If on
0
1683
by: none | last post by:
Hi, I've got a problem with losing session state in ASP.NET version 2. It does it intermittently - sometimes it tanks - and sometimes it works OK. I've got the ASP.NET state service started - the separate process for state management: -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- StateServer mode stores session state in a process, referred to as the ASP.NET state service, that is separate...
4
1890
by: Not Me | last post by:
Hi, I have a set of pages that use forms authentication for access. There are times when one of the session objects I'm using appears to disappear. The session is not timing out, however. (if I go to a page that doesn't use that specific object it works fine and I'm not redirected to the login page) Apologies if I'm using the incorrect terminology.. the session object I'm using is a class of my own, which features several private...
5
6135
by: chromis | last post by:
Hi there, I've recently been updating a site to use locking on application level variables, and I am trying to use a commonly used method which copies the application struct into the request scope. Application variables are then accessed in this manner Request.App.<Var>. To begin with I had a simple functioning login system inside a subdirectory named admin, this subdirectory had it's own application.cfm, I wasn't sure whether to duplicate...
0
9602
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, 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...
0
9439
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,...
0
10071
jinu1996
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...
1
10017
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8905
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, 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...
0
6690
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
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...

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.