HighTechTalks DotNet Forums  

Re: Can't get impersonation to work

Dotnet Security microsoft.public.dotnet.security


Discuss Re: Can't get impersonation to work in the Dotnet Security forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Fernando Vicaria [MSFT]
 
Posts: n/a

Default Re: Can't get impersonation to work - 06-23-2004 , 04:29 PM






Check out this article:
http://msdn.microsoft.com/library/de...ersonation.asp

Your code will probably require FullTrust trust independently of the user
you impersonate.

Let me know if you still have problems after that.

"ECrawford" <ECrawford (AT) discussions (DOT) microsoft.com> wrote

Quote:
I have a .Net application and one of my ASP pages exports a Crystal Reports
file to a network drive. The problem is that when Crystal exports the file,
it uses the ASPNET user account, which doesn't have access rights to the
network drive.

I want to impersonate the authenticated user when I do the export, but it
doesn't seem to work. When I run the app, FileMon shows that it is still
using ASPNET.

I have tried adding the <identity impersonate="true" userName="validuser"
password="validpass"/> to my web.config file, but that doesn't work
either. I did think I had this working yesterday, but today it doesn't
seem to be ?!?!

I have also tried the following code:

currentWindowsIdentity =
CType(User.Identity,System.Security.Principal.Wind owsIdentity)
impersonationcontext = currentWindowsIdentity.Impersonate()

ReportName.Export()

impersonationcontext.Undo()

This shows the impersonation elements to be the same as the authenticated
user, but the app still blows up and FileMon still shows ASPNET as the
user.

What am I doing wrong?!?!?!

THanks,
Ed




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.