473,400 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,400 software developers and data experts.

Is User Authenticated?

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

Dec 11 '06 #1
3 16236
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" <md*****@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro 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

Dec 11 '06 #2
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" <md*****@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro 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
Dec 11 '06 #3
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" <md*****@gmail.comwrote in message
news:11**********************@16g2000cwy.googlegro 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" <md*****@gmail.comwrote in message
news:11**********************@f1g2000cwa.googlegro 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

Dec 11 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: bunnytail | last post by:
hi all, I wonder if its possible in Apache authentication scheme, to have a special user that will be authenticated without password in interanl network, while other users still have to follow...
4
by: Ollie | last post by:
I am looking to implement impersonation in an ASP application I am writing and am using the MS article Q306158 as a reference. This article refers to "the IIS Authenticated Account or User". Can...
3
by: Kristofer Liljeblad | last post by:
Hi, 1. How can I "terminate" an authenticated user? (I would like the server to redirect the user to the login page again. I'm using "forms authentication".) 2. Is it possible to enumerate...
2
by: David Krussow | last post by:
The 2nd parameter of the method controls whether a persistent cookie is created - so that ASP.NET can "know" if the current user has been previously authenticated (during previous browser...
2
by: Dan | last post by:
hi ng, i have a problem with windows authentification. i want to forward every user who 1. is not authorized 2. or could not be authenticated to a login page -------------------
2
by: gabriel.salama | last post by:
I am desperately trying to create a login page in ASP.NET in which a user can be authenticated against a Domino Directory but for the life of me, I cannot even find anything remotely close to this...
3
by: shapper | last post by:
Hello, How to I check if a user is authenticated and if it is what is its role? I am using Asp.Net 2.0 and forms authentication. Thanks, Miguel
9
by: Gordon | last post by:
I want to add a feature to a project I'm working on where i have multiple users set up on my Postgres database with varying levels of access. At the bare minimum there will be a login user who...
2
by: shapper | last post by:
Hello, How can I check if a user is authenticated? I am using ASP.NET Membership forms authentication. Thanks, Miguel
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.