Click to See Complete Forum and Search --> : impersonation issue


vandel212
06-19-2010, 07:45 PM
Hi, I wrote an asp.net application that I'm trying to run on a godaddy domain I bought. I need to read a file in a folder that I did not give read access to so that your average user cannot see in the informaion in that folder. I assumed that the asp.net program would have the same credentials as myself because server-side code. Turns out I am wrong. When I go to use the asp.net application it throws an access denied error saying that the ASP.NET user account has to be given permissions to access the folder. After talking to two different tech support people at godaddy I've come to the realization that they are either dumb or lazy (or a combo of the two).

I came across some code that you can put into the web.config file that would allow the asp.net application to impersonate a user, which would work great to use myself as the impersonated user. However it seems that godaddy cannot give me the name of the server that my domain is on (that's understandable) so I don't know what to put in the identity tag to get this to work.

Here is the code I found:


<identity impersonate="true" userName="contoso\Jane" password="pass"/>

**UPDATE**
I would like to make one small update to this thread:

I tried using this indentity tage:

<identity impersonate="true" />

and when I went to use the site it prompted me for a username and password. so when I put in the username and password, it worked. So I filled out the impersonate tag with:


<identity impersonate="true" userName="\username" password="password"/>

(of course I filled in the username and password with the correct info)

When I went to use it again it threw this error:

System.Web.HttpException: The current identity (PHX3\username) does not have write access to 'C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files'.

Any thoughts?

pons_saravanan
06-22-2010, 12:44 AM
hi
I am not sure whether you will be having an option to change the security permissions of the folder where your virtual directory is.

If you can add the user you have specified in the web.config to this folder's secuity, Your application should be able to access the folder with the username you have specified in web.config.