By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,574 Members | 3,021 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,574 IT Pros & Developers. It's quick & easy.

HttpContext.Current.User.Identity.Name loses value

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
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

P: n/a
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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.