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. Open document from server on client

Open document from server on client

Scheduled Pinned Locked Moved ASP.NET
csharpsysadminsecurityhelpquestion
6 Posts 4 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.
  • Y Offline
    Y Offline
    yftah1989
    wrote on last edited by
    #1

    Hi, I have a list of doc files located on a server, I need to open them on a client side in asp .net form. I don't want the users to be able to enter the directories or the files (security permissions) directly, \\servername\c$\directory name, so I removed all security permissions, but I still want the users to be able to open the files from the web site, can you help me? thanks, Yefi

    modified on Tuesday, February 15, 2011 7:59 AM

    P Y P 3 Replies Last reply
    0
    • Y yftah1989

      Hi, I have a list of doc files located on a server, I need to open them on a client side in asp .net form. I don't want the users to be able to enter the directories or the files (security permissions) directly, \\servername\c$\directory name, so I removed all security permissions, but I still want the users to be able to open the files from the web site, can you help me? thanks, Yefi

      modified on Tuesday, February 15, 2011 7:59 AM

      P Offline
      P Offline
      Paulo Zemek
      wrote on last edited by
      #2

      You can receive the filename by a querystring.

      string filename = Request.QueryString["filename"];

      Then you can validate everything you need and, if the file is a simple textfile, you can open it and write all its contents to the page. You can even do this with other file formats, but then you must set the document type and maybe need to use a page only to "download" the file.

      Y 1 Reply Last reply
      0
      • P Paulo Zemek

        You can receive the filename by a querystring.

        string filename = Request.QueryString["filename"];

        Then you can validate everything you need and, if the file is a simple textfile, you can open it and write all its contents to the page. You can even do this with other file formats, but then you must set the document type and maybe need to use a page only to "download" the file.

        Y Offline
        Y Offline
        yftah1989
        wrote on last edited by
        #3

        Not good for me, if the filename permissions on the server are minimum I can't open the file.

        P 1 Reply Last reply
        0
        • Y yftah1989

          Not good for me, if the filename permissions on the server are minimum I can't open the file.

          P Offline
          P Offline
          Paulo Zemek
          wrote on last edited by
          #4

          But not even the code running at the server side is able to open the file? If that's the case, it will be impossible to solve. I think what you want is something like this: Direct connections to a folder or http folder: They are not able to access the files. Connections to a page - Such page will be able to see only files located at "some directory". If "some directory" is protected from reading, you may need some type of impersonation. But, then, the flow will be: Clients (without any access) will access your page at the server. Such page will have some type of impersonation, can verify if the file only contains the names (no .., no drive letter and so on) and, even then, it only has access to one directory. It reads the file (if valid) and then returns its contents. If you need, I can detail better about impersonation, but I don't think that you will really need that.

          1 Reply Last reply
          0
          • Y yftah1989

            Hi, I have a list of doc files located on a server, I need to open them on a client side in asp .net form. I don't want the users to be able to enter the directories or the files (security permissions) directly, \\servername\c$\directory name, so I removed all security permissions, but I still want the users to be able to open the files from the web site, can you help me? thanks, Yefi

            modified on Tuesday, February 15, 2011 7:59 AM

            Y Offline
            Y Offline
            Yusuf
            wrote on last edited by
            #5

            First you need to give the user some way of selecting which file they need to open. This can be done through may ways, may be you list all the files on you page? Once a user selects (knows) which file they want, they don't permission on the server side. But asp.net will definitely need a permission to read/access the files from that folder. If asp.net does not have permission then it will fail.

            Yusuf May I help you?

            1 Reply Last reply
            0
            • Y yftah1989

              Hi, I have a list of doc files located on a server, I need to open them on a client side in asp .net form. I don't want the users to be able to enter the directories or the files (security permissions) directly, \\servername\c$\directory name, so I removed all security permissions, but I still want the users to be able to open the files from the web site, can you help me? thanks, Yefi

              modified on Tuesday, February 15, 2011 7:59 AM

              P Offline
              P Offline
              Pete OHanlon
              wrote on last edited by
              #6

              In order to open the document on the client side, the encoding must be set to an appropriate type for the relevant document. The thing you need to set is known as the MIME type, for instance - if you want to open up an Excel document, the content type should be set to application/vnd.ms-excel. I hope that this helps.

              I'm not a stalker, I just know things. Oh by the way, you're out of milk.

              Forgive your enemies - it messes with their heads

              My blog | My articles | MoXAML PowerToys | Onyx

              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