Julito Avellaneda
Julito Avellaneda

Reputation: 2385

Access NAS from web site on IIS

I have a web site mount on a Windows server 2003 and I have a NAS and I need to save some files there. These files are auploaded from the site that I have mapped the NAS which I passing a letter for that NAS.

I've configured the site to use a local user also a domain user but, when I try to upload the file I get the following error:

Could not find a part of the path  E:/file.pdf .
    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy)
    at System.IO.FileStream..ctor(String path, FileMode mode)
    at System.Web.HttpPostedFile.SaveAs(String filename)
    at System.Web.UI.WebControls.FileUpload.SaveAs(String filename)
    at registro_reg_otra_informacion.btn_subir_archivo_Click(Object sender, EventArgs e)

I hope that can help me, thanks!

Upvotes: 0

Views: 2646

Answers (2)

Gthompson83
Gthompson83

Reputation: 1099

I would suggest saving the uploaded file to a temp directory in the IIS server then use a FileSystemWatcher to move the file from the IIS server to the NAS.

Upvotes: 0

Joe
Joe

Reputation: 1669

Accessing Mapped Network Drives via ASP.NET in IIS 6

...accessing drives via mapped drive letters is frowned upon, likely the layer of redirection, as drives can be REMAPPED by evil-doers. The preferred way to access network shares is via UNC...

http://www.hanselman.com/blog/AccessingMappedNetworkDrivesViaASPNETInIIS6.aspx

Upvotes: 1

Related Questions