Session variable problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,

Please help me with the following:

In login.aspx page:

Session("accessGranted") = 1
Response.Write("<script>window.open(""userpage.aspx"", ""User"");</script>")


In userpage.aspx:

<body>
<script language="vb" runat="server">

Sub Page_Load(source as Object, e as EventArgs)

if Session("accessGranted") is nothing then
response.redirect("login_failed.htm")
end if

end sub

</script>

Problem:
Every time a user logs in the first time the userpage.aspx doesn't see the Session and kicks the user out. However, when you repeat the login, the page sees the Session. It looks as if the session were created then the userpage opens - can it be? What should I do to avoid this problem?


Thanks,

Alex Fimine
(e-mail address removed)
 
It looks as if the session were created then the userpage opens

According to your code, the Session variable is initialized BEFORE userpage
opens:
In login.aspx page:
Session("accessGranted") = 1
Response.Write("<script>window.open(""userpage.aspx"",
""User"");</script>")

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

Alex Fimine said:
Hi,

Please help me with the following:

In login.aspx page:

Session("accessGranted") = 1
Response.Write("<script>window.open(""userpage.aspx"",
"User""); said:
In userpage.aspx:

<body>
<script language="vb" runat="server">

Sub Page_Load(source as Object, e as EventArgs)

if Session("accessGranted") is nothing then
response.redirect("login_failed.htm")
end if

end sub

</script>

Problem:
Every time a user logs in the first time the userpage.aspx doesn't see the
Session and kicks the user out. However, when you repeat the login, the page
sees the Session. It looks as if the session were created then the userpage
opens - can it be? What should I do to avoid this problem?
 
Kevin, I know that according to the code the session is created BEFORE - that, not surprisingly, was my intention. However, as I explained, there is a problem with that.
 
Back
Top