Change user identity to aspnet

Posted by Nishithraj under C# on 3/8/2010 | Views : 3100 | Status : [Member] | Replies : 2
I have a console application. Here the default identity is the current identity of the windows account. I need to delete all files of a folder as a aspnet user(it has delete previllage in that folder)

How do we change the identiy to aspnet user in console application by code(not by config file)?

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan



Responses

Posted by: Vuyiswamb on: 3/8/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down
Am not sure if that is Possible. Ms Dos has limited Commands. I remember we used to Switch Users in linux using the "su" Command. but in command prompt in Win OS i dont think you can do that.



Thank you for posting at Dotnetfunda
[Administrator]

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Abhi2434 on: 3/9/2010 [Member] [Microsoft_MVP] [MVP] Silver

Up
0
Down
You need ASP.NET impersonation.

see this
http://www.dotnet-guide.com/impersonation3.html


For normal impersonation, you need
http://www.codeproject.com/KB/cs/cpimpersonation1.aspx




www.abhisheksur.com

Nishithraj, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response