Session variable problem

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)
 
K

Kevin Spencer

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?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,051
Latest member
CarleyMcCr

Latest Threads

Top