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. Reponse.WriteFile Issue

Reponse.WriteFile Issue

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netsysadminhelp
3 Posts 3 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.
  • S Offline
    S Offline
    salmonraju
    wrote on last edited by
    #1

    Hi, I have a file in other computer say (\\10.10.10.10\\sharedFolder\abc.txt) and asp.net is running on local computer Can I use Response.WriteFile to server this file when client requested. Response.WriteFile("\\10.10.10.10\\sharedFolder\abc.txt"); But I am getting an exception saying file does not exists at location : c:\\inetpub\\wwwroot\\10.10.10.10\\sharedFolder\abc.txt Please let me know how we can do this. Thanks,

    D R 2 Replies Last reply
    0
    • S salmonraju

      Hi, I have a file in other computer say (\\10.10.10.10\\sharedFolder\abc.txt) and asp.net is running on local computer Can I use Response.WriteFile to server this file when client requested. Response.WriteFile("\\10.10.10.10\\sharedFolder\abc.txt"); But I am getting an exception saying file does not exists at location : c:\\inetpub\\wwwroot\\10.10.10.10\\sharedFolder\abc.txt Please let me know how we can do this. Thanks,

      D Offline
      D Offline
      Dinesh Mani
      wrote on last edited by
      #2

      It is not a good practice to access the file system except your application root from a web application. If you should then you need to use a user credential with a elevated access rights than the default IIS user. Server admins won't let you do that. BTW, Response.WriteFile does not read a file, it writes the response to the file on the current execution directory. To really write into a file you need to use File objects. Do you want to write data into the file or read the file and display the data to your users on your application?

      1 Reply Last reply
      0
      • S salmonraju

        Hi, I have a file in other computer say (\\10.10.10.10\\sharedFolder\abc.txt) and asp.net is running on local computer Can I use Response.WriteFile to server this file when client requested. Response.WriteFile("\\10.10.10.10\\sharedFolder\abc.txt"); But I am getting an exception saying file does not exists at location : c:\\inetpub\\wwwroot\\10.10.10.10\\sharedFolder\abc.txt Please let me know how we can do this. Thanks,

        R Offline
        R Offline
        Rutvik Dave
        wrote on last edited by
        #3

        Try using following if the file is on the same server

        Response.WriteFile("~\\sharedFolder\abc.txt");

        Or use following if the file is not on the same server

        Response.WriteFile(@"http://10.10.10.10/sharedFolder/abc.txt");

        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