Detailed steps for ASP. NET to access shared folders, asp.net detailed steps
Assume that the ASP. NET program you are looking for is located on server A, and the index file is located in the ZzkIndex shared folder on server B. The access address is \ 192.168.18.18 \ ZzkIndex \. To achieve this, you can read and write files in the Shared Folder \ 192.168.18.18 \ ZzkIndex \ in the ASP. NET program of server.
Procedure:
(Note: server A is the server where ASP. NET programs are located, and server B is the server where shared folders are located)
① Create A Windows account with the same user name and password on the two servers (both server A and server B must be created). For example, assume that the user name is ZzkIndexer and the password is zzk.cnblogs.com.
② Cancel the Remote Control permissions of the ZzkIndexer account on the two servers (so that this account has as few permissions as possible), for example:
③ Remove the ZzkIndexer account on server B from all user groups (including Users), for example:
Does not belong to any user group? Yes. Do not doubt that it has been tested in practice.
④ Create a shared folder ZzkIndex on server B and grant the write permission to the ZzkIndexer account. You need to set two permissions: file system permission and shared permission.
File System permission settings are as follows:
The share permission settings are as follows:
⑤ Create A virtual directory in IIS of server A to point to the shared folder of server B, for example:
Click "OK". If the Access to the path '\ 192.168.18.18 \ ZzkIndex' is denied.
⑥ Add account simulation settings in the web. config file of ASP. NET program on server:
<system.web> <identity impersonate="true" userName="ZzkIndexer" password="zzk.cnblogs.com"/></system.web>
7. On server A, set "C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ Temporary ASP.. NET Files, and grant the ZzkIndexer Account Modification permission (Note: v4.0.30319 is the current.. NET Framework Version ). Otherwise, an error occurs during running: The current identity (ZzkIndexer) does not have write access to 'C: \ Windows \ Microsoft. NET \ Framework64 \ v4.0.30319 \ Temporary ASP. NET Files '.
Everything is ready, only test is not available! Use a simple test. aspx page to test the Code as follows:
<%@ Page Language="C#" AutoEventWireup="true" %><script runat="server">protected void Page_Load(object sender, EventArgs e){ System.IO.File.Create(Server.MapPath("/ZzkIndex/cnblogs.txt"));}</script>
After accessing test. aspx, check the content in the ZzkIndex shared file of server B:
Summary
"Solving problems + writing a blog" may take twice as long as "solving problems + not writing a blog", but after writing it, you no longer have to worry about this problem again, this will never happen again. The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.