Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How can this be possible? - Part 3

How can this be possible? - Part 3

Scheduled Pinned Locked Moved ASP.NET
sysadminsecuritycsharpasp-netdatabase
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    v1i9n6o7d
    wrote on last edited by
    #1

    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 see http://192.168.0.1/abtsweb/Genericerrorpage.htm?aspxerrorpath=/abtsweb/readingtextfile.aspx Now what should be done in this case.

    M 1 Reply Last reply
    0
    • V v1i9n6o7d

      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 see http://192.168.0.1/abtsweb/Genericerrorpage.htm?aspxerrorpath=/abtsweb/readingtextfile.aspx Now what should be done in this case.

      M Offline
      M Offline
      mohankatari
      wrote on last edited by
      #2

      Hi, I too worked on this where in Web.config file I gave identity impersonate="true" username="MY ID" password="PASSWORD"

      V 1 Reply Last reply
      0
      • M mohankatari

        Hi, I too worked on this where in Web.config file I gave identity impersonate="true" username="MY ID" password="PASSWORD"

        V Offline
        V Offline
        v1i9n6o7d
        wrote on last edited by
        #3

        Thanx a lot. It worked. :-D

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups