473,659 Members | 2,591 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HttpContext.Cur rent.User is it unique?

Hi,

Is HttpContext.Cur rent.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 2807
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.Cur rent.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.Cur rent.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 formsauthentica tion 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 authenticationt icket is generated and
stored into a cookie.

Userdetails are queried from the database using
HttpContext.Cur rent.User.Ident ity.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
17785
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
5062
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
17075
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 requests), the wrong user info is being returned.
4
7925
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 can I pass-on HTTPContext.Current info to thread. I used WindowsImpersonationContext for...
15
2513
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 inherit System.Security.Principal and store all of the information currently stored in Session...
4
10165
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 name even is, I am having problems because apparently after 30 minutes...
3
8893
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 unit test cases fail because there is no HttpContext for them.
0
4783
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 gain access with the new userid. We created a web page to show what...
13
53228
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 HttpContext.Current.User has a completely different value. Within the ValidateUser() I'm constructing my custom...
0
8428
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
8339
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,...
1
8535
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,...
0
8629
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6181
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
4176
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2757
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
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.