How can this be possible? - Part 3
-
Read through the scenario. client A wants to read files from another client B present in the same network. But this reading should be done through a ASP.NET web application . In other words a client should be able to read a text file present on another client in the same network. This scenario would be applicable in an intranet application. The thing to note is that the path of client B would be present in the server. The client A would pick the path from the server and navigate automatically to client B, hunt down the necessary folder and read the text files and store the necessary data in a database. Here is the code on which I am working
protected void Button1_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); StreamReader sr = new StreamReader(@"\\Pc4\C$\NDP\Test1.csv"); string line; while((line = sr.ReadLine()) != null) { Label1.Text += line; } }
The client A when he executes this code is intending to access another client B (Here it is PC4 in the same domain). The code resides on server in Win 2K3 box. I have identity impersonate="true" in web.config. In the Directory security I have Anonymous Access and Windows Authentication turned on. So the basic flow is Client A User requests through browser an aspx file residing on the server. On the form provided by the aspx file he clicks on the button to open a file in a location specified in the above mentioned code. This location is present on a machine (named PC4) which belongs in the same domain as client A. The NDP folder mentioned in the path is also shared and contains access permissions for user account who is making request as client A. When I click on the button, it gives me a HTTP 404 error - stating File or Directory not found. In the address bar I get to seehttp://192.168.0.1/abtsweb/Genericerrorpage.htm?aspxerrorpath=/abtsweb/readingtextfile.aspx
Now what should be done in this case. -
Read through the scenario. client A wants to read files from another client B present in the same network. But this reading should be done through a ASP.NET web application . In other words a client should be able to read a text file present on another client in the same network. This scenario would be applicable in an intranet application. The thing to note is that the path of client B would be present in the server. The client A would pick the path from the server and navigate automatically to client B, hunt down the necessary folder and read the text files and store the necessary data in a database. Here is the code on which I am working
protected void Button1_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); StreamReader sr = new StreamReader(@"\\Pc4\C$\NDP\Test1.csv"); string line; while((line = sr.ReadLine()) != null) { Label1.Text += line; } }
The client A when he executes this code is intending to access another client B (Here it is PC4 in the same domain). The code resides on server in Win 2K3 box. I have identity impersonate="true" in web.config. In the Directory security I have Anonymous Access and Windows Authentication turned on. So the basic flow is Client A User requests through browser an aspx file residing on the server. On the form provided by the aspx file he clicks on the button to open a file in a location specified in the above mentioned code. This location is present on a machine (named PC4) which belongs in the same domain as client A. The NDP folder mentioned in the path is also shared and contains access permissions for user account who is making request as client A. When I click on the button, it gives me a HTTP 404 error - stating File or Directory not found. In the address bar I get to seehttp://192.168.0.1/abtsweb/Genericerrorpage.htm?aspxerrorpath=/abtsweb/readingtextfile.aspx
Now what should be done in this case.Hi, I too worked on this where in Web.config file I gave identity impersonate="true" username="MY ID" password="PASSWORD"
-
Hi, I too worked on this where in Web.config file I gave identity impersonate="true" username="MY ID" password="PASSWORD"