• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 332
  • Last Modified:

Virtual Directory cannot Write file

I am using VB.net and have created an aspx application to upload photos.  For the development I just used a sub folder to the application folder on my local machine and everything works fine.  However, once I deploy the application I will need to use a virtual folder to a file server (this does not have asp.net installed and is not in any domain) to store the photos due to the overall size.

I have replaced my sub folder with a virtual folder on my local machine and when creating the virtual folder I used admin credencials, but when I now try to create and delete files I catch the following message

Logon failure: unknown user name or bad password.

If I enable directory browsing then I can browse the folders through IE.

I know this is a security thing but don't know how the aspnet account works with virtual folders located on another computer

Thanks in advance
1 Solution
a very simple solution to this is to add a single line to the web.config file
if you add the following line

<identity impersonate="true" userName="[domain / machine name]\[username]" password="[password]"/>

that as you may have guessed sets up impersonation. disadvantage is that you have to have the password in plain text, unless someone knows of a way not to.

as you are not concerned with a domain you may have to put the machine name in its place or you may be able simply to exclude it, if you exclude it remove the \ afterwards.

hope that is of some help


Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now