Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Upload File to Mapped Drive

Posted on 2004-09-14
6
Medium Priority
?
494 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
  • 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 200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Independent Software Vendors: 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!

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…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

886 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