In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
Today, I will talk to you about how to use ASP.NET to access shared folders. Many people may not know much about it. In order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.
Suppose the ASP.NET program you are looking for is on server A, and the index file is in the ZzkIndex shared folder of server B. the access address is\\ 192.168.18.18\ ZzkIndex\. To achieve this is to be able to read and write files in the shared folder\ 192.168.18.18\ ZzkIndex\ in the ASP.NET program of the A server.
Specific operation steps:
(note: server An is the server where the ASP.NET program is located, and Server B is the server where the shared folder is located.)
① sets up Windows accounts with the same user name and password on both servers (both An and B servers). For example, suppose the user name is ZzkIndexer and the password is zzk.cnblogs.com.
② removes remote control (Remote Control) permissions from the ZzkIndexer account on both servers (leaving this account with as few permissions as possible), as shown below:
③ removes the ZzkIndexer account on server B from all user groups (including Users), as shown in the following figure:
Does not belong to any user group? Yes, there is no doubt that it has been tested in practice.
④ creates a shared folder ZzkIndex on server B and grants write permissions to the ZzkIndexer account. There are two permissions that need to be set, one is file system permissions, and the other is sharing permissions.
The file system permissions are set as shown below:
The share permissions are set as follows:
⑤ creates a virtual directory in the IIS of server A that points to the shared folder of server B, as shown below:
After clicking "OK", if there is an error of access denial (Access to the path'\ 192.168.18.18\ ZzkIndex' is denied.), ignore it.
⑥ add account impersonation settings in the web.config file of the ASP.NET program on server A:
⑦ on the A server, set the file system permission of "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 number). Otherwise, an error will occur at run time: The current identity (ZzkIndexer) does not have write access to'C:\ Windows\ Microsoft.NET\ Framework64\ v4.0.30319\ Temporary ASP.NET Files'.
⑧ has everything, only testing! Test it with a simple test.aspx page with the following code:
Protected void Page_Load (object sender, EventArgs e) {System.IO.File.Create (Server.MapPath ("/ ZzkIndex/cnblogs.txt");}
After accessing test.aspx, look at the contents of the ZzkIndex shared file on server B:
After reading the above, do you have any further understanding of how to use ASP.NET to access shared folders? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.