Solved

Upload File to Mapped Drive

Posted on 2004-09-14
6
489 Views
Last Modified: 2008-02-01
I have Web Application on Machine A which will upload all the files to shared folder (Machine B) which is mapped drive (P:\) on Machine A.
This error occured when i try to upload file..

--------------------------------------------------------------------------------------------------------------------------------------------------------
Could not find a part of the path "P:\0000000127.swf".
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.DirectoryNotFoundException: Could not find a part of the path "P:\0000000127.swf".
---------------------------------------------------------------------------------------------------------------------------------------------------------

Please advise. Thanks.
0
Comment
Question by:ztot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 10

Expert Comment

by:jnhorst
ID: 12061661
Using mapped drives in ASP.NET is a hit and miss proposition.  Use a UNC path instead:  \\ServerName\ShareName\Folder\file.ext

John
0
 

Author Comment

by:ztot
ID: 12061970
John, i had try ur method, but now i encounter another problem as stated below:
Logon failure: unknown user name or bad password.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: Logon failure: unknown user name or bad password.
0
 
LVL 10

Accepted Solution

by:
jnhorst earned 50 total points
ID: 12068206
Here's what is going on: When you access a website or sweb service, if you are not required to enter a username and password, the web server is accepting your request as an anonymous user.  If you go to the IIS settings on the web server and look under Directory Security there is a button for editing authentication settings for anonymous users.  By default your web server will use an account named IUSR_<machine name>.  Your web server will also have an account named ASPNET.  Both of these accounts are local to that machine.  You have the server on which the file exists (the one named in your UNC path).  That server knows nothing about the local accounts on your web server, so it will not allow the access.

In you look in your web.config and you do not have the following:

<identity impersonate="true" />

then your web server is using its local ASPNET account when it executes ASP.NET code.  If you do have this, or you put it in (I recommend doing so) then your web server will use the IUSR_... account specified in the IIS settings to execute code.

So what you want to do is this: Create a domain or Active Directory account on your network that will be used to authenticate anonymous requests on your web server.  Change the settings in IIS to use this new account instead of the IUSR_... account.  Then make sure this new account has the needed permissions to the wwwroot folder on the web server.  Give this new account the same permissions that the IUSR_... account has for wwwroot.  Make sure you have that identity tag above in web.config.  Do the same thing for your dev machine's IIS settings and web.config.

Now go to the server that has the files you are trying to access by way of the UNC path.  Give the new domain account permissions on the root folder for which your web site needs access.

Now when you try to run the website on either your dev box or the regular server, the code will run under the same domain account, which has been given permissions to the file server you are trying to access.

John

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ztot
ID: 12071432
Thanks a lot John, one last thing is, is it possible to do this on the network without domain?
Other than this, any other options to solve the same problem?

FYI, I have added following code into web.config file and gave permission for the remote machine folder for this domain user

<system.web>
<identity impersonate="true" userName="mydomain\myusername"
password="mypassword" />
0
 
LVL 10

Expert Comment

by:jnhorst
ID: 12071537
If it is a peer-to-peer network, the you would need to make sure that all machines in question had local accounts with the same username and password.

John
0
 

Author Comment

by:ztot
ID: 12072249
thanks : )
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question