473,386 Members | 1,754 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,386 software developers and data experts.

HttpContext.Current.User.Identity.Name loses value

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 HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?

Apr 30 '07 #1
4 10091
in asp.net, authentication is independent of session. if its not set,
then you page is not requiring authentication.

-- bruce (sqlwork.com)

Doogie wrote:
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 HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?
Apr 30 '07 #2
I'm not dealing with authentication. I'm trying to read the value in
that HttpContext.Current.User.Identity.Name value and it goes away
after 30 minutes. First time I go through it's there.
Apr 30 '07 #3
Doogie wrote:
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 HttpContext.Current.User.Identity.Name is no longer
returning a value. I think it has something to do with session
information only being available for 20 minutes by default.

Is there another way to get the user id other than
HttpContext.Current.User.Identity.Name?
There's Request.ServerVirables("AUTH_USER") (or LOGON_USER i believe,
which gives same result if i remember correctly)
However, this property also comes out of httpcontext:

HttpContext.Current.ApplicationInstance.Request.Se rverVirables("AUTH_USER")

I don't know if that will solve you problem or not.
Apr 30 '07 #4
Since it's part of HttpContext I'm guessing it'll be an issue as well,
but thank you. I did find out that if I do my refresh before the 20
minutes (say every 15), I don't lose that info in the HttpContext
object. It stays for quite some time (until my cookie expires and I
have to reget all my info then it goes away). Not sure why this is
but I think that's what I'll go with.

May 1 '07 #5

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

Similar topics

0
by: Giovanni Bassi | last post by:
Hello Group, I using impersonation on my web app. I am explicitely setting the User with the identity element in the web.config like this: <identity impersonate="true" userName="MyUsr"...
4
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: ...
10
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 ...
1
by: vvenk | last post by:
Hello: I am trying to initialize a User object at application start: Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) ' Fires when the application is started Dim loOutcome...
2
by: nalbayo | last post by:
what's the difference between HttpContext.Current.User.Identity.Name; and Context.User.Identity.Name; thanks!
6
by: Sjaakie | last post by:
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...
0
by: D-Someone | last post by:
We have an active directory user that just had her username renamed. When the user is running an application that calls our CurrentUser web service method (which returns the value of...
2
by: Abraham Andres Luna | last post by:
hello everyone, does anyone know why i can't access the HttpContext.Current.User.Identity.Name property in a .cs file? this is the index.aspx page: <%@ Page Language="C#" %> <script...
0
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...

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.