I use form authentication.
When a user request a page it must first load some settings. These settings
will be placed inside the context.items. I can add this method in all pages
but that is not what I want. Easier will be one declaration...
This loading happens inside the global.asax file. This way it load
automaticly the settings, no matter what page the user request. This is what
I want.
Now the loading method uses some information from the current browsing
client. It want to know the roles from the current browsing client. I can't
get these from inside the global.asax file. This is the problem. I get the
messege that the object is not set to a reference.
When adding/calling this method from an aspx file then it works... I want
that it works inside the global.asax file.
This is the problem, hope someone haves a solution.
Thanks!
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us>
schreef in bericht news:%2***************@TK2MSFTNGP14.phx.gbl...
Hi,
I'm not very clear of what you mean with contex and roles, are you trying
to access Win auth? If so do this:
protected void Session_Start(Object sender, EventArgs e)
{
string login = WindowsIdentity.GetCurrent().Name.Substring(
WindowsIdentity.GetCurrent().Name.LastIndexOf(@"\" )+1 );
Session["SystemUser"] = login ;
}
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Arjen" <bo*****@hotmail.com> wrote in message
news:de**********@news1.zwoll1.ov.home.nl... Hi,
I load my website settings inside the global.asax file. For this I have
to
use the context, to get the roles from the current browsing client.
The problem is that there is no context at that time. (no reference) When
I add these code
lines (from global.asax) inside an aspx file, then it works. Because
there is a context.
How can I use this code inside the global.asax file?
I tried it in this:
protected void Application_BeginRequest(Object sender, EventArgs e) {}
protected void Application_AuthenticateRequest(Object sender, EventArgs
e) {}
But this did not work. I'm using asp.net 2.0.
Hope someone can help.