473,657 Members | 2,476 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is User Authenticated?

Hello,

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

If Membership.Vali dateUser("shapp er", "27lamps11" ) Then
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( Me.User.Identit y.IsAuthenticat ed.ToString)
Else
Response.Write( "# User is Not Authenticated #")
End If

I get "FalseFalseFals e".

What is going on?

Thanks,
Miguel

Dec 11 '06 #1
3 16260
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.goog legroups.com...
Hello,

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

If Membership.Vali dateUser("shapp er", "27lamps11" ) Then
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( Me.User.Identit y.IsAuthenticat ed.ToString)
Else
Response.Write( "# User is Not Authenticated #")
End If

I get "FalseFalseFals e".

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.Vali dateUser("usern ame", "pass") Then
FormsAuthentica tion.SetAuthCoo kie("shapper", True)
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( User.Identity.I sAuthenticated. ToString)
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.IsAuthe nticated.ToStri ng, My.User.IsAuthe nticated.ToStri ng or
User.Identity.I sAuthenticated. 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.goog legroups.com...
Hello,

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

If Membership.Vali dateUser("shapp er", "27lamps11" ) Then
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( Me.User.Identit y.IsAuthenticat ed.ToString)
Else
Response.Write( "# User is Not Authenticated #")
End If

I get "FalseFalseFals e".

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.IsAuthe nticated.ToStri ng, My.User.IsAuthe nticated.ToStri ng or
User.Identity.I sAuthenticated. 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.goog legroups.com...
Hi Juan,

It is working now. Could you tell me if this is the right way:
If Membership.Vali dateUser("usern ame", "pass") Then
FormsAuthentica tion.SetAuthCoo kie("shapper", True)
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( User.Identity.I sAuthenticated. ToString)
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.IsAuthe nticated.ToStri ng, My.User.IsAuthe nticated.ToStri ng or
User.Identity.I sAuthenticated. 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.goog legroups.com...
Hello,

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

If Membership.Vali dateUser("shapp er", "27lamps11" ) Then
Response.Write( Request.IsAuthe nticated.ToStri ng)
Response.Write( My.User.IsAuthe nticated.ToStri ng)
Response.Write( Me.User.Identit y.IsAuthenticat ed.ToString)
Else
Response.Write( "# User is Not Authenticated #")
End If

I get "FalseFalseFals e".

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
1235
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 the regular policy. I've tried to use "satisfy any/all" in .htaccess file. AuthName "Me Only" AuthType Basic
4
2572
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 anyone tell me where I can find out more about this account? - the permissions it has - what group if any it belongs to - the user name of the account - etc. Cheers,
3
1888
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 all sessions on a IIS? Is it possible to enumerate all authenticated users on a IIS (without the use of global.asax and session_start and session_end)?
2
2090
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 sessions). My question: How can code I write elsewhere in the application retrieve that cookie - or otherwise "know" if the current user has been authenticated? My intent is to have some pages in the application that do not require authentication in...
2
3833
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
2630
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 on the internet. It's like nobody has ever needed to do this. I already did it in a ColdFusion page and I'm amazed at how incredibly easy it was using the CFLDAP tag. I would have thought that a task like this would have been equally easy in...
3
4593
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
6271
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 only has read access to the users table so that users can log in. Once a user has been logged in successfully I want to escalate that user's access level to one appropriate to their role, which will include switching the postgres user they are...
2
1628
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
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8842
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8516
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1733
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.