简体   繁体   中英

How to Access a share folder from server using ASP.net C#?

I'm want to access a share folder from my computer to server. But for access a folder from server need to key in the username and password. The below code is shows how could i commend for work it. But the issues is, it cannot function, it shows error

"An exception of type 'System.ComponentModel.Win32Exception' occurred in System.dll but was not handled in user code Additional information: The network path was not found"

I'm already use google and search about it. But i could not find a specific solution for solve it. Please help me. I'm really need yours help...

protected void Button1_Click(object sender, EventArgs e)
        {
            string username = "admim";
            string pwrd = "admin321";
            {
                Process.Start(@"\\192.168.4.18\" + username + pwrd + "iso documents");
            }
        }

尝试这个

Process.Start("explorer.exe", @"c:\temp");

检查此链接,这有助于您访问具有凭据的文件夹

To access IUSR_WEBSERVER must have right to access You can add following config

<system.web> <identity impersonate="true" userName="IUSR_WEBSERVER" password="password" /> </system.web>

Refer to http://www.codeproject.com/Articles/19830/How-to-Access-Network-Files-using-asp-net

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM