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. Reading Files

Reading Files

Scheduled Pinned Locked Moved ASP.NET
securityasp-netdatabasesysadminwindows-admin
2 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

    Hi, I have the directory named NDP on my local machine (named PC4) which is in a domain. On my domain server, I have IIS 6.0 (windows 2003) and database server. I have the following sample code protected void Button1_Click(object sender, EventArgs e) { Label1.Text = ""; DataTable dt = new DataTable(); StreamReader sr = new StreamReader(@"\\Pc4\C$\NDP\Test1.csv"); string line; while((line = sr.ReadLine()) != null) { Label1.Text += line; } I have impersonate="true" in web.config file. The authentication mode is WIndows Integrated authentication. I have given permissions to ASPNET accounts and Windows accounts for the NDP folder. Can I read this .csv file? Because it is giving me error. I have also this code. protected void Page_Load(object sender, EventArgs e) { String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name; Label1.Text = username; } When executed it gives me the name of the user through which I have logged in but does not give access to my shared folder. Totally stumped. Any Solutions???:confused:

    M 1 Reply Last reply
    0
    • V v1i9n6o7d

      Hi, I have the directory named NDP on my local machine (named PC4) which is in a domain. On my domain server, I have IIS 6.0 (windows 2003) and database server. I have the following sample code protected void Button1_Click(object sender, EventArgs e) { Label1.Text = ""; DataTable dt = new DataTable(); StreamReader sr = new StreamReader(@"\\Pc4\C$\NDP\Test1.csv"); string line; while((line = sr.ReadLine()) != null) { Label1.Text += line; } I have impersonate="true" in web.config file. The authentication mode is WIndows Integrated authentication. I have given permissions to ASPNET accounts and Windows accounts for the NDP folder. Can I read this .csv file? Because it is giving me error. I have also this code. protected void Page_Load(object sender, EventArgs e) { String username = System.Security.Principal.WindowsIdentity.GetCurrent().Name; Label1.Text = username; } When executed it gives me the name of the user through which I have logged in but does not give access to my shared folder. Totally stumped. Any Solutions???:confused:

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      It's not good idea to read the file from other machine in ASP.NET. What you should do is that you should create the web service that can copy the file from a particular machine (e.g. PC4 in your case) and upload those files to the service at specific time. then, read those files from your ASP.NET.

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      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