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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. Authentication

Authentication

Scheduled Pinned Locked Moved ASP.NET
csharpsecurityhelpquestion
11 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.
  • A Ahmed Galal

    am using c# to develop a web application but i have a problem in the download section of my web site, the web application open the file using File.IO then makes Response.BinaryWrite() to send the file to the user, the problem is that everytime the user try to download it shows a Windows Dialog Box asking for the username and the password of the host account, however i set the Athentication to Forms and allow all users in the web config file, any ideas ? thanx in advance.

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

    SomeOne_SurVive wrote: Response.BinaryWrite() Why are you using this,you may only make a hyperlink that its target is the path of the downloadable file.

    A 1 Reply Last reply
    0
    • M MoustafaS

      SomeOne_SurVive wrote: Response.BinaryWrite() Why are you using this,you may only make a hyperlink that its target is the path of the downloadable file.

      A Offline
      A Offline
      Ahmed Galal
      wrote on last edited by
      #3

      i'll turn the download section for only registered members in the future, thats why am using Response.BinaryWrite(); thanx for reply

      M 1 Reply Last reply
      0
      • A Ahmed Galal

        i'll turn the download section for only registered members in the future, thats why am using Response.BinaryWrite(); thanx for reply

        M Offline
        M Offline
        MoustafaS
        wrote on last edited by
        #4

        You can use what i said to you and turn it also in the future by using the Authorization .

        A 1 Reply Last reply
        0
        • M MoustafaS

          You can use what i said to you and turn it also in the future by using the Authorization .

          A Offline
          A Offline
          Ahmed Galal
          wrote on last edited by
          #5

          okay, lets consider that i'm in the future :), how to set it up using Authorization, i'v been trying but its not working, can u give example ? thanx

          M 1 Reply Last reply
          0
          • A Ahmed Galal

            okay, lets consider that i'm in the future :), how to set it up using Authorization, i'v been trying but its not working, can u give example ? thanx

            M Offline
            M Offline
            MoustafaS
            wrote on last edited by
            #6

            In your web.config : So the anonemus users will be redirected to your login form.

            A 1 Reply Last reply
            0
            • M MoustafaS

              In your web.config : So the anonemus users will be redirected to your login form.

              A Offline
              A Offline
              Ahmed Galal
              wrote on last edited by
              #7

              it seems like u didn't get the problem, try the following link: http://www.icfsthinktank.org/English/Publications/Binary.aspx?id=27&pos=file&[^] it will open a Windows Dialog Box asking for the host password, however i set to allow all users in the authorization section in the web config file, i think if i gave a full permission for the aspnet account at the folder that contains the files it may work, but how am gonna do this since its not my server, its just a host. thanx for ur time.

              M 1 Reply Last reply
              0
              • A Ahmed Galal

                it seems like u didn't get the problem, try the following link: http://www.icfsthinktank.org/English/Publications/Binary.aspx?id=27&pos=file&[^] it will open a Windows Dialog Box asking for the host password, however i set to allow all users in the authorization section in the web config file, i think if i gave a full permission for the aspnet account at the folder that contains the files it may work, but how am gonna do this since its not my server, its just a host. thanx for ur time.

                M Offline
                M Offline
                MoustafaS
                wrote on last edited by
                #8

                You may add that forlder as a virtual folder to the website root.

                D 1 Reply Last reply
                0
                • A Ahmed Galal

                  am using c# to develop a web application but i have a problem in the download section of my web site, the web application open the file using File.IO then makes Response.BinaryWrite() to send the file to the user, the problem is that everytime the user try to download it shows a Windows Dialog Box asking for the username and the password of the host account, however i set the Athentication to Forms and allow all users in the web config file, any ideas ? thanx in advance.

                  D Offline
                  D Offline
                  DavidNohejl
                  wrote on last edited by
                  #9

                  ASP.NET says quite clearly what must be done: ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access. You (user {MACHINENAME}/ASPNET) don't have rights to write or read that .pdf file. You (IIS administartor) must grant this user I/O permissions. You say it's not your server...you have a problem. Contact your webhosting, they will (hopefully) help you. You need to grant ASP.NET right to read from "d:\i\c\icfsthinktank\www\Classes\Publications\Files\". I emphasised in that error message what must be done. Obviously, it's not something you can do without admin. David

                  A 1 Reply Last reply
                  0
                  • M MoustafaS

                    You may add that forlder as a virtual folder to the website root.

                    D Offline
                    D Offline
                    DavidNohejl
                    wrote on last edited by
                    #10

                    No, that's not the problem. Problem is that user running ASP.NET worker process ( {MACHINENAME}ASPNET ) does not have right to read/write that file. You set it in windows actually, not in IIS. David

                    1 Reply Last reply
                    0
                    • D DavidNohejl

                      ASP.NET says quite clearly what must be done: ASP.NET is not authorized to access the requested resource. Consider granting access rights to the resource to the ASP.NET request identity. ASP.NET has a base process identity (typically {MACHINE}\ASPNET on IIS 5 or Network Service on IIS 6) that is used if the application is not impersonating. If the application is impersonating via <identity impersonate="true"/>, the identity will be the anonymous user (typically IUSR_MACHINENAME) or the authenticated request user. To grant ASP.NET write access to a file, right-click the file in Explorer, choose "Properties" and select the Security tab. Click "Add" to add the appropriate user or group. Highlight the ASP.NET account, and check the boxes for the desired access. You (user {MACHINENAME}/ASPNET) don't have rights to write or read that .pdf file. You (IIS administartor) must grant this user I/O permissions. You say it's not your server...you have a problem. Contact your webhosting, they will (hopefully) help you. You need to grant ASP.NET right to read from "d:\i\c\icfsthinktank\www\Classes\Publications\Files\". I emphasised in that error message what must be done. Obviously, it's not something you can do without admin. David

                      A Offline
                      A Offline
                      Ahmed Galal
                      wrote on last edited by
                      #11

                      thanx dnh for ur help, that was my openion too, i contacted them but it seems like they r sux and won't allow me do that, i'll try with them again or find another way, thank you.

                      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