Recently, I received a request to access files on other hosts. I thought I had to map the files with a network ing disk and then read the local files. I didn't expect to solve the permission problem. After searching the information, the solution is as follows:
- Of course, it is mapped to the network address. Suppose the ing is "Z: \" here. Generally, a user name and password will be provided to you for security purposes. Suppose it is user1 and pwd1.
- Add a virtual directory in IIS. If it is "/out", it indicates "Z :\"
- Add a user in Windows user management, including the user name and password provided above (user1 and pwd1 here), and change the user to the Administrator group, if necessary, you can restrict this user from logging on to the machine remotely to ensure certain security.
- Add a web directory to the directory where the ing disk needs to be read. config, in system. add a node under the Web node: <identity impersonate = "true" username = "user1" Password = "pwd1"/> (the user name and password are the same as above)
In this way, all the settings will be fine. Read the content in the/out directory in the test: directory. exists (server. mappath ("/out");, it should be set back to true.