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!