473,516 Members | 2,910 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpContext.Current.User is it unique?

Hi,

Is HttpContext.Current.User unique for each visitor or is it shared
across an application?

Have some problems that might have to do with this and found
contradictory answers on this question.

Thanks!
Feb 2 '06 #1
6 2773
It's taken from HTTP headers (the docs say HTTP request), so yes it
should be unique and will be taken from IIS's authentication.

Feb 2 '06 #2
Chris S. > It's taken from HTTP headers (the docs say HTTP request), so
yes it
should be unique and will be taken from IIS's authentication.


Thanks.
Although it didn't solve my problem I now know where not to look.

Feb 2 '06 #3
HttpContext represents the context of particular Http request.
User property is responsible for authorized visitors. That is if users load web app with anonymous auth.

Then afaik you will have the same user, but many visitors.

You can use Session property of Page class. Session is unique for each visitor. A combination if Session and HttpContext can be used
to distinguish between visitors with the same auth.

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com

"Sjaakie" <ke**@secret.it> wrote in message news:43***********************@news.xs4all.nl...
Hi,

Is HttpContext.Current.User unique for each visitor or is it shared
across an application?

Have some problems that might have to do with this and found
contradictory answers on this question.

Thanks!
Feb 2 '06 #4
The context is unique to the current request and bound to each individual
user session when the request begins, until the request completes and the
response is returned when the context then goes out of scope.
--
Regards

John Timney
Microsoft MVP

"Sjaakie" <ke**@secret.it> wrote in message
news:43***********************@news.xs4all.nl...
Hi,

Is HttpContext.Current.User unique for each visitor or is it shared across
an application?

Have some problems that might have to do with this and found contradictory
answers on this question.

Thanks!

Feb 2 '06 #5
It's taken from a HTTP header as the headers collection will show you.

Feb 2 '06 #6
Chris S. schreef:
It's taken from HTTP headers (the docs say HTTP request), so yes it
should be unique and will be taken from IIS's authentication.


Maybe you have a clue what's causing this ...

I built a site with custom formsauthentication which acts pretty weird
for some people. These (3) people have in common that their surnames are
'Doe' and that all 3 live in Hong Kong. Login, email and passwords differ.
Authentication is based on a combination of login and password. If both
match with values in database an authenticationticket is generated and
stored into a cookie.

Userdetails are queried from the database using
HttpContext.Current.User.Identity.Name-value as login. Which should be
the login of the current user.
Somehow these 3 people all see the userdetails of one particular mister
Doe. Checked my procedures multiple times to make sure I didn't store
credentials into the application cache, which wasn't the case.

Could it be possible the server is caching the Identity.Name?
Or could this have to do with some sort of proxy-server?
Or something else....
Feb 3 '06 #7

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

Similar topics

4
17768
by: Dan Bart | last post by:
I am using an application which is a modification of IBuySpy Portal. It is using Forms authentication. Users login and their name is added to Context Then I use: Web.HttpContext.Current.User.Identity.Name to write audit trail as to what users do. Now recently on one of the activities I noticed that the
5
5037
by: coollzh | last post by:
who can tell the detailed difference of: HttpRuntime, Context, HttpContext.Current sometimes, we can use Context Object instead of HttpContext.Current; sometimes, we can user HttpRuntime Directly.....
10
17034
by: kiran_s_rao | last post by:
I have a serious issue that seems to be intermittent with User.Identity.Name. In an environment where about 100+ users are logging on to a site with forms authentication, calling HttpContext.Current.User.Identity.Name returns the correctly logged on user. However, 10% of the time (I'm guessing under stress conditions or simulataneous...
4
7903
by: Makarand Keer | last post by:
Hi All I have problem in using Threading. I have ASP.NET application in which I am using multithreading to start a process. Now the object instances which are used in this thread access HttpContext.Current to get Session Variable value. Here my code fails. Thread on which the process is running does not have HTTPContext.Current object. How...
15
2464
by: Jason | last post by:
Currently, I am storing information about the currently logged on user in Session variables that are stored in SQL. However, I am using role-based security, so I am storing custom roles in a GenericPrincipal object that I attached to Context.User. My question is this: Can I create a new class, ExtendedPrincipal for instance, and simply...
4
10115
by: Doogie | last post by:
Hi, I am using HttpContext.Current.User.Identity.Name to get a user id from a web application. I then use that as part of a name of a cookie I'm writing. 30 minutes later I do a refresh of this page and try to access that cookie. However, because I am using HttpContext.Current.User.Identity.Name to get the user id to know what that cookie...
3
8875
by: Madhur | last post by:
Hello I am delivering an asp.net 2.0 application to my customer. I need to know, If I need to check for the condition of HttpContext.Current to be null in my business logic. I have extensively used Cache and Session objects, and currently I assume HttpContext.Current object to be existent. Also, since I do not have this check, some of my...
0
4765
by: =?Utf-8?B?QW50b25pbyBPJydOZWFs?= | last post by:
We changed a username in AD. The user now logs on to a computer on our network using the new username without any problems. They can not logon using the old username. However, when they access a IIS 6.0 web site where a programmer compares system.web.httpcontext.current.user.identity.name to a lookup table containing usernames they could not...
13
53032
by: bproddu | last post by:
Hi, I'm using Forms authentication for my web app. I've a custom Principal class that I would like to set to the HttpContext.Current.User after the Membership.ValidateUser() passes. I'm able to set the value in the login form, however when FormsAuthentication.RedirectFromLoginPage() redirects the call to my Default.aspx the...
0
7182
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...
0
7408
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. ...
0
7581
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7142
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...
0
5714
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5110
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...
0
4773
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3267
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
488
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...

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.