Hi,

I've got a Assembly that impersonates a user giving other credentials.
When I use the class in a Sharepoint Webpart, it runs like this:

protected void Button1_Click(object sender, System.EventArgs e)
{
//Here always is MyUser

Page.Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
//Impersonation method is called here
//And here always is Administrator

Page.Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
}

But why when i click Button1 the user is MyUser? I have tested the
impersionation class in ASP.NET 2.0 environment and I don't lost the
impersonated credentials when a postback is made. How can I solve
that? I really need to solve it.

Thak you very much.

Re: Losing impersonation when postback on webparts by Mike

Mike
Thu Jul 24 02:30:15 CDT 2008

Post these kind of programming questions to the newsgroup for them
(development_and_programming).

That's where the programming experts are ..

Mike Walsh
WSS FAQ http://www.wssfaq.com / http://wss.collutions.com
no questions by e-mail please



luismi.lemer@gmail.com wrote:
> Hi,
>
> I've got a Assembly that impersonates a user giving other credentials.
> When I use the class in a Sharepoint Webpart, it runs like this:
>
> protected void Button1_Click(object sender, System.EventArgs e)
> {
> //Here always is MyUser
>
> Page.Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
> //Impersonation method is called here
> //And here always is Administrator
>
> Page.Response.Write(System.Security.Principal.WindowsIdentity.GetCurrent().Name);
> }
>
> But why when i click Button1 the user is MyUser? I have tested the
> impersionation class in ASP.NET 2.0 environment and I don't lost the
> impersonated credentials when a postback is made. How can I solve
> that? I really need to solve it.
>
> Thak you very much.