Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Session variable problem

Reply
Thread Tools

Session variable problem

 
 
=?Utf-8?B?QWxleCBGaW1pbmU=?=
Guest
Posts: n/a
 
      07-07-2004
Hi,

Please help me with the following:

In login.aspx page:

Session("accessGranted") = 1
Response.Write("<script>window.open(""userpage.asp x"", ""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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
 
Kevin Spencer
Guest
Posts: n/a
 
      07-08-2004
> 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.asp x"",

""User"");</script>")

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

"Alex Fimine" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> Please help me with the following:
>
> In login.aspx page:
>
> Session("accessGranted") = 1
> Response.Write("<script>window.open(""userpage.asp x"",

""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 Removed)



 
Reply With Quote
 
 
 
 
=?Utf-8?B?QWxleCBGaW1pbmU=?=
Guest
Posts: n/a
 
      07-08-2004
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.




"Kevin Spencer" wrote:

> > 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.asp x"",

> ""User"");</script>")
>
> --
> HTH,
> Kevin Spencer
> ..Net Developer
> Microsoft MVP
> Big things are made up
> of lots of little things.
>
> "Alex Fimine" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi,
> >
> > Please help me with the following:
> >
> > In login.aspx page:
> >
> > Session("accessGranted") = 1
> > Response.Write("<script>window.open(""userpage.asp x"",

> ""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 Removed)

>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System Session Variable VS. Own-declared 'Session' Variable chowchho ASP .Net 7 03-28-2008 02:38 PM
Session Timeout problems-web.confg session state and IIS session s =?Utf-8?B?Um9iSEs=?= ASP .Net 4 04-11-2007 04:52 PM
s there a way to set a session variable by session ID? admiller97@gmail.com ASP .Net 1 11-14-2005 05:13 PM
Session State - What does it take to establish one single ASP.NET session per "browser session" Jeff Smythe ASP .Net 3 01-02-2004 04:10 AM
How can I "know" the difference between a session timed out and a session that did session.abort? Jazzis ASP General 2 09-23-2003 07:16 AM



Advertisments