Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > User.Identity.IsAuthenticated return true

Reply
Thread Tools

User.Identity.IsAuthenticated return true

 
 
Zulander
Guest
Posts: n/a
 
      08-21-2006
Hi, For some reason my session are expireing when the web browser
closes and User.Identity.IsAuthenticated is truning true,
I have a webcrontrol from login:

Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Login1.LoggedIn
Dim UserTicket As FormsAuthenticationTicket = New
FormsAuthenticationTicket(1, Login1.UserName, DateAndTime.Now,
DateAndTime.Now.AddSeconds(1), False, "WebUser",
FormsAuthentication.FormsCookiePath)
FormsAuthentication.Encrypt(UserTicket)
end sub

and in my secure page i have tha fallowing:


Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

If Not User.Identity.IsAuthenticated Then
FormsAuthentication.RedirectToLoginPage()
Exit Sub
End If

did i do anything wrong ?

p.s: my authentication type is :form !
thank you

 
Reply With Quote
 
 
 
 
Tim_Mac
Guest
Posts: n/a
 
      08-21-2006
hi zulander,
can you post your web.config? i usually secure pages or folders via
web.config with a <locations> setting instead of by code.
i know you said you have Forms Auth in your web.config, but it looks like
that isn't set up correctly, or else the Forms ticket is still valid in
Page_Load.
also, why are you granting the ticket for 1 second?
it may help to find out what User.Identity.Name is in your Page_Load, it
could be the IIS guest account or the Forms user.

tim


"Zulander" <> wrote in message
news: oups.com...
> Hi, For some reason my session are expireing when the web browser
> closes and User.Identity.IsAuthenticated is truning true,
> I have a webcrontrol from login:
>
> Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Login1.LoggedIn
> Dim UserTicket As FormsAuthenticationTicket = New
> FormsAuthenticationTicket(1, Login1.UserName, DateAndTime.Now,
> DateAndTime.Now.AddSeconds(1), False, "WebUser",
> FormsAuthentication.FormsCookiePath)
> FormsAuthentication.Encrypt(UserTicket)
> end sub
>
> and in my secure page i have tha fallowing:
>
>
> Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Me.Load
>
> If Not User.Identity.IsAuthenticated Then
> FormsAuthentication.RedirectToLoginPage()
> Exit Sub
> End If
>
> did i do anything wrong ?
>
> p.s: my authentication type is :form !
> thank you
>



 
Reply With Quote
 
 
 
 
Zulander
Guest
Posts: n/a
 
      08-21-2006
Tim_Mac, This is my web.config

<authentication mode="Forms">
<forms loginUrl="login.aspx"/>
</authentication>


<location path="login.aspx">
<system.web>
<authorization>
<allow users="*" />
</authorization>
</system.web>
</location>

The part with the one second is that i was testing if it was the cause
of not expiring,
it was actualy: Dim UserTicket As FormsAuthenticationTicket =
New FormsAuthenticationTicket(1, Login1.UserName, DateAndTime.Now,
DateAndTime.Now, False, "WebUser", FormsAuthentication.FormsCookiePath)

The, user is the authenticated user that was loged therfore it is not
the guest account !
thank you

Tim_Mac wrote:
> hi zulander,
> can you post your web.config? i usually secure pages or folders via
> web.config with a <locations> setting instead of by code.
> i know you said you have Forms Auth in your web.config, but it looks like
> that isn't set up correctly, or else the Forms ticket is still valid in
> Page_Load.
> also, why are you granting the ticket for 1 second?
> it may help to find out what User.Identity.Name is in your Page_Load, it
> could be the IIS guest account or the Forms user.
>
> tim
>
>
> "Zulander" <> wrote in message
> news: oups.com...
> > Hi, For some reason my session are expireing when the web browser
> > closes and User.Identity.IsAuthenticated is truning true,
> > I have a webcrontrol from login:
> >
> > Protected Sub Login1_LoggedIn(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Login1.LoggedIn
> > Dim UserTicket As FormsAuthenticationTicket = New
> > FormsAuthenticationTicket(1, Login1.UserName, DateAndTime.Now,
> > DateAndTime.Now.AddSeconds(1), False, "WebUser",
> > FormsAuthentication.FormsCookiePath)
> > FormsAuthentication.Encrypt(UserTicket)
> > end sub
> >
> > and in my secure page i have tha fallowing:
> >
> >
> > Protected Sub Page_Load(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Me.Load
> >
> > If Not User.Identity.IsAuthenticated Then
> > FormsAuthentication.RedirectToLoginPage()
> > Exit Sub
> > End If
> >
> > did i do anything wrong ?
> >
> > p.s: my authentication type is :form !
> > thank you
> >


 
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
[False,True] and [True,True] --> [True, True]????? bdb112 Python 45 04-29-2009 02:35 AM
what value does lack of return or empty "return;" return Greenhorn C Programming 15 03-06-2005 08:19 PM
C and C++ are interoperable languages? True or Not True? Chip C++ 6 01-08-2005 11:10 PM
Does true ^ true return false? Siemel Naran C++ 19 06-18-2004 11:06 AM
difference between return true; and return false; w i l l Javascript 4 07-04-2003 10:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57