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

Context.user not retaining it's value

I'm attempting to use the context.user object. In my login code, I add
an identity to the context.user. I can use the debugger to watch it
stuff the identity into the context.user object, but when I later try to
check the context.user.identity.name it contains the empty string ("").

Does anyone know why this would be the case?

John

Nov 17 '05 #1
2 1163
John,

The context object is recreated every page load.

Are you trying to use it later in the code, on a different page, or on
postback to the same page?

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"John Kraft" <jh*****@ilstu.edu> wrote in message
news:bh**********@malachite.ilstu.edu...
I'm attempting to use the context.user object. In my login code, I add
an identity to the context.user. I can use the debugger to watch it
stuff the identity into the context.user object, but when I later try to
check the context.user.identity.name it contains the empty string ("").

Does anyone know why this would be the case?

John

Nov 17 '05 #2
John Saunders wrote:
"John Kraft" <jh*****@ilstu.edu> wrote in message
news:bh**********@malachite.ilstu.edu...
S. Justin Gengo wrote:

John,

The context object is recreated every page load.

Are you trying to use it later in the code, on a different page, or on
postback to the same page?

Sincerely,


Well, that would certainly explain it.

Here's the dealio...
I am currently using(attempting to use) forms authentication on a site.
We have only certain directories which need to have the user log in.
What I wanted to do was put a little login box on each page and if the
user chose to use the login box, it would carry his credentials with
him. Than way, if he later went to one of the directories that required
authentication, he would already be authenticated and let in


automatically.
The problem is... I really don't fully understand what I am doing and
was trying to mimic the code that I have (copied from some example on
the net) in the global asax file in the authenticate_request method.

I strongly suggest you look into Forms Authentication (see "Forms
Authentication Provider" at
http://msdn.microsoft.com/library/de...lications.asp).

When you do, I also strongly suggest that you first forget everything you
know about the technique you were trying to use. Then, once you understand
Forms Authentication, you can see how it relates to what you've got now.
I've seen too many attempts to twist Forms Authentication into something it
wasn't meant to do, rather than learn what it actually does.


Ok... I appreciate you pointing me at that site. I've read it. It
pretty much makes sense, and our forms auth is working as advertised.

Now... to do what I wish to do... in theory... all I should have to do
is authenticate the user myself in my little login box, and then add a
cookie to the system.

Isn't this correct?

Well, it won't let me add a cookie to the system.
Response.cookies.add() doesn't seem to work from my little control.

Argh???

John

Nov 17 '05 #3

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

Similar topics

19
by: jeff | last post by:
how do you convert form byte to Int32 while retaining the binary value of the byte array
5
by: lgbjr | last post by:
Hello All, I have several Pictureboxes (linked to an AccessDB) on a VB.NET form. I would like to use a context menu to allow the user to open the picture in their default picture viewer or...
3
by: tshad | last post by:
I am playing with GenericPrincipal classes and am using a sample program to test it. The problem is that even though I set the roles (which shows the roles in the Context.User as being there),...
3
by: brisco5 | last post by:
I have a TEXTAREA element. A user right clicks within in to get the context menu and they select "paste". I want my javascript code to know that they selected "paste". I know you can capture the...
1
by: Greg Hurlman | last post by:
I have an HttpModule that captures the FormsAuthenticationModule.Authenticate event, and replaces the HttpContext principal with a custom principal. The code is straightforward enough, yet when...
2
by: s4lin | last post by:
problem is pagination not retaining data field i have form with general data field, and i need to select some option which is store in database, so i open another page with retrieving data from...
1
by: qwikstix | last post by:
I have a right click menu on my page and when I right click but click away instead of choosing an option, I get very weird behavior on the rest of the page. The text input controls are unable to...
5
by: Bels | last post by:
I am currently designing a real estate website using Dreamweaver CS3, php, MySQL on a Mac. On it is a 'property search' form that queries the property database. The form consists of 5 dropdown lists....
1
by: Anjana Bhat | last post by:
Hi, im using asp.net with c#.In my form i have a list of html radio button group in which if i select one,a text box and an image is loaded .This i have done thro. javascript.but in the same page...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...

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.