Ask a Question related to ASP.NET Security, Design and Development.
-
aneesh #1
Iprincipal & IIdentity problem
HI All,
I ma new to .NET. I was a java programmer for the past 2 years, and now
shifted to .NET. My company (A product based company) is rewritng an existing
portal produt from java to .NET, using c# and asp.NET. I ma into the
authntication module of this particular development.
I have developed some classes called TeNPrincipal wich impliments the
IPrincipal and TeNIdentity which impliments the IIdentity, when I have a
certain other properties for our portal user specific thing.
Now after successfull authentication in the login.aspx.as codebehind, i set
the formsauthcookie and create a new instance of the TeNprincipal and
Tenidentoty and add this TeNIdentity to the TeNPrincipal.
Now the next thing i do is do something like this:
Context.User = newTeNPrincipal(Context.User.Identity, TeNSecurity.GetRoles());
and redirects tothe desktop.aspx
Now on the
desktop.aspx when i try
TeNPrincipal principal = (TeNPrincipal) HttpContext.curent.User;
I get error invalid cast:
And whne i chek the type of HttpContext.curent.User it shows GenericPrincipal)
I also tried TeNPrincipal principal = (TeNPrincipal) Context.User;
None worked. what could be wrong. for the timebeing, I made a wrapper class
which returns and sets the TeNPrinicipla for the
user(TeNSecurity.SetPrincipal(...) && TeNsecurity.GetPrincipal() will return
the Ten principal where I am setting it something like this:
HttpContext.Current.Session.Add("TENPRINCIPAL",pri ncipal);
Now I want that Context.User = Tenprincipal to work.
What could be wrong?
Regards
Aneesh A.V
aneesh Guest
-
Customer IPrincial and IIdentity
Hi, I need to push some more information than just username and roles in the IPrincipal implementation. For this, I wrote the following code... -
Custom IPrincipal and declarative security checking
download http://www.pluralsight.com/toolcontent/show_pipeline.zip put the ashx file in a web app and run it through your browser - you'll see the... -
Marshaling IIdentity via web services.
Is there a way to marshal an object via a web service that implements IIdentity? Thanks -
how to add another property to class inheriting from IIdentity?
Hello peoples this is a question regarding security of windows application I want to add another property (the UserID) to... -
IPrincipal
Anyone work with the IPrincipal object in an ASP.NET web app? Just wondering how it is used and if there are any best practice documents anyone is... -
Brock Allen #2
Re: Iprincipal & IIdentity problem
You must reset the HttpContent.User on each request into the application.
You should do this in global.asax (or in a HttpModule) in the Application_AuthenticateRequest
event.
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
> HI All,
> I ma new to .NET. I was a java programmer for the past 2 years, and
> now
> shifted to .NET. My company (A product based company) is rewritng an
> existing
> portal produt from java to .NET, using c# and asp.NET. I ma into the
> authntication module of this particular development.
> I have developed some classes called TeNPrincipal wich impliments the
> IPrincipal and TeNIdentity which impliments the IIdentity, when I have
> a certain other properties for our portal user specific thing.
>
> Now after successfull authentication in the login.aspx.as codebehind,
> i set the formsauthcookie and create a new instance of the
> TeNprincipal and Tenidentoty and add this TeNIdentity to the
> TeNPrincipal.
>
> Now the next thing i do is do something like this: Context.User =
> newTeNPrincipal(Context.User.Identity, TeNSecurity.GetRoles());
>
> and redirects tothe desktop.aspx
>
> Now on the desktop.aspx when i try
>
> TeNPrincipal principal = (TeNPrincipal) HttpContext.curent.User;
> I get error invalid cast:
> And whne i chek the type of HttpContext.curent.User it shows
> GenericPrincipal)
> I also tried TeNPrincipal principal = (TeNPrincipal) Context.User;
>
> None worked. what could be wrong. for the timebeing, I made a wrapper
> class which returns and sets the TeNPrinicipla for the
> user(TeNSecurity.SetPrincipal(...) && TeNsecurity.GetPrincipal() will
> return the Ten principal where I am setting it something like this:
> HttpContext.Current.Session.Add("TENPRINCIPAL",pri ncipal);
>
> Now I want that Context.User = Tenprincipal to work.
>
> What could be wrong?
>
> Regards
> Aneesh A.V
Brock Allen Guest



Reply With Quote

