Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Is User Authenticated?

Reply
Thread Tools

Is User Authenticated?

 
 
shapper
Guest
Posts: n/a
 
      12-11-2006
Hello,

I need to check if a user is authenticated. I tried everything I could
think and find:

If Membership.ValidateUser("shapper", "27lamps11") Then
Response.Write(Request.IsAuthenticated.ToString)
Response.Write(My.User.IsAuthenticated.ToString)
Response.Write(Me.User.Identity.IsAuthenticated.To String)
Else
Response.Write("# User is Not Authenticated #")
End If

I get "FalseFalseFalse".

What is going on?

Thanks,
Miguel

 
Reply With Quote
 
 
 
 
Juan T. Llibre
Guest
Posts: n/a
 
      12-11-2006
I have already explained to you that Authentication is not the same as validating Membership.

You will *always* get False when validating Membership data
against Authenticated users, who must login with Windows credentials.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"shapper" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
> Hello,
>
> I need to check if a user is authenticated. I tried everything I could
> think and find:
>
> If Membership.ValidateUser("shapper", "27lamps11") Then
> Response.Write(Request.IsAuthenticated.ToString)
> Response.Write(My.User.IsAuthenticated.ToString)
> Response.Write(Me.User.Identity.IsAuthenticated.To String)
> Else
> Response.Write("# User is Not Authenticated #")
> End If
>
> I get "FalseFalseFalse".
>
> What is going on?
>
> Thanks,
> Miguel
>



 
Reply With Quote
 
 
 
 
shapper
Guest
Posts: n/a
 
      12-11-2006
Hi Juan,

It is working now. Could you tell me if this is the right way:
If Membership.ValidateUser("username", "pass") Then
FormsAuthentication.SetAuthCookie("shapper", True)
Response.Write(Request.IsAuthenticated.ToString)
Response.Write(My.User.IsAuthenticated.ToString)
Response.Write(User.Identity.IsAuthenticated.ToStr ing)
Else
Response.Write("# User is Not Authenticated #")
End If

And can you tell me which code line should I use to verify if a user is
authenticated:
Request.IsAuthenticated.ToString, My.User.IsAuthenticated.ToString or
User.Identity.IsAuthenticated.ToString?

Thank You,
Miguel

Juan T. Llibre wrote:
> I have already explained to you that Authentication is not the same as validating Membership.
>
> You will *always* get False when validating Membership data
> against Authenticated users, who must login with Windows credentials.
>
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> "shapper" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > Hello,
> >
> > I need to check if a user is authenticated. I tried everything I could
> > think and find:
> >
> > If Membership.ValidateUser("shapper", "27lamps11") Then
> > Response.Write(Request.IsAuthenticated.ToString)
> > Response.Write(My.User.IsAuthenticated.ToString)
> > Response.Write(Me.User.Identity.IsAuthenticated.To String)
> > Else
> > Response.Write("# User is Not Authenticated #")
> > End If
> >
> > I get "FalseFalseFalse".
> >
> > What is going on?
> >
> > Thanks,
> > Miguel
> >


 
Reply With Quote
 
Juan T. Llibre
Guest
Posts: n/a
 
      12-11-2006
re:
> And can you tell me which code line should I use to verify if a user is authenticated:
> Request.IsAuthenticated.ToString, My.User.IsAuthenticated.ToString or
> User.Identity.IsAuthenticated.ToString?


Which ones return valid responses ?
You can use any which return valid responses.

Remember, they will only produce valid results if you're using Forms Authentication and Membership.
They will *not* authenticate a user if you're using Windows Integrated Security.




Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaņol : http://asp.net.do/foros/
===================================
"shapper" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ups.com...
Hi Juan,

It is working now. Could you tell me if this is the right way:
If Membership.ValidateUser("username", "pass") Then
FormsAuthentication.SetAuthCookie("shapper", True)
Response.Write(Request.IsAuthenticated.ToString)
Response.Write(My.User.IsAuthenticated.ToString)
Response.Write(User.Identity.IsAuthenticated.ToStr ing)
Else
Response.Write("# User is Not Authenticated #")
End If

And can you tell me which code line should I use to verify if a user is
authenticated:
Request.IsAuthenticated.ToString, My.User.IsAuthenticated.ToString or
User.Identity.IsAuthenticated.ToString?

Thank You,
Miguel

Juan T. Llibre wrote:
> I have already explained to you that Authentication is not the same as validating Membership.
>
> You will *always* get False when validating Membership data
> against Authenticated users, who must login with Windows credentials.
>
>
>
>
> Juan T. Llibre, asp.net MVP
> asp.net faq : http://asp.net.do/faq/
> foros de asp.net, en espaņol : http://asp.net.do/foros/
> ===================================
> "shapper" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) ups.com...
> > Hello,
> >
> > I need to check if a user is authenticated. I tried everything I could
> > think and find:
> >
> > If Membership.ValidateUser("shapper", "27lamps11") Then
> > Response.Write(Request.IsAuthenticated.ToString)
> > Response.Write(My.User.IsAuthenticated.ToString)
> > Response.Write(Me.User.Identity.IsAuthenticated.To String)
> > Else
> > Response.Write("# User is Not Authenticated #")
> > End If
> >
> > I get "FalseFalseFalse".
> >
> > What is going on?
> >
> > Thanks,
> > Miguel
> >



 
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
Restrict user if user directly types url of any page Jaydeep ASP .Net 3 06-30-2006 04:40 AM
Re: How to get user's full name using HttpContext.Current.User Mike Newton ASP .Net 0 07-23-2004 03:56 PM
user.isinrole in user control Somyos Jinkow ASP .Net 1 06-01-2004 11:16 AM
Reference a user controls properties from another user control?? =?Utf-8?B?YWJqb3Jr?= ASP .Net 1 05-05-2004 02:41 PM
Manipulating a User Control from another User Control Tom Rowton ASP .Net 2 08-01-2003 08:18 PM



Advertisments