webclient object and forms authentication

Ask a Question related to ASP.NET Security, Design and Development.

  1. #1

    Default webclient object and forms authentication

    How do I download file from the web when the site uses forms authentication?
    Without the authentication, webclient object works.

    Thanks,

    Buran


    buran Guest

  2. Similar Questions and Discussions

    1. Accessing htm files without authentication (forms authentication)
      I have application with forms authentication. All works fine. When user opens .aspx file gets login form, login and then get the .aspx page. But...
    2. ASP.Net Forms authentication with basic authentication popup
      Relatively new to ASP.Net but have a strange problem. My site uses forms authentication for a large administration section however after the user...
    3. Forms authentication then redirection to a secure web with NT authentication?
      Hi, I want to allow access to particular secured intranet web sites. These intranet are stored in sharepoint (2003 version) Actually I've...
    4. Authentication ticket, cookieless, forms authentication?
      Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the...
    5. webclient object and downloading output file from an intranet site
      Dear ASP.NET Programmers, I have an intranet site (web applicaton) with the login page http://burak/database/login.aspx. The site implements...
  3. #2

    Default Re: webclient object and forms authentication

    "buran" <buran@buran.com> wrote in message
    news:eihAvdfeDHA.4024@TK2MSFTNGP11.phx.gbl...
    > How do I download file from the web when the site uses forms
    authentication?
    > Without the authentication, webclient object works.
    You have to log in, same as a user would.
    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]


    John Saunders Guest

  4. #3

    Default Re: webclient object and forms authentication

    How can I login using WebClient or WebRequest object? Could you please give
    sample code?

    Thakn you

    "John Saunders" <john.saunders@surfcontrol.com> wrote in message
    news:#JGg2vieDHA.1820@TK2MSFTNGP10.phx.gbl...
    > "buran" <buran@buran.com> wrote in message
    > news:eihAvdfeDHA.4024@TK2MSFTNGP11.phx.gbl...
    > > How do I download file from the web when the site uses forms
    > authentication?
    > > Without the authentication, webclient object works.
    >
    > You have to log in, same as a user would.
    > --
    > John Saunders
    > Internet Engineer
    > [email]john.saunders@surfcontrol.com[/email]
    >
    >

    buran Guest

  5. #4

    Default Re: webclient object and forms authentication

    "buran" <buran@buran.com> wrote in message
    news:ewuaQV4eDHA.1828@TK2MSFTNGP10.phx.gbl...
    > How can I login using WebClient or WebRequest object? Could you please
    give
    > sample code?
    Not really. The only code I have which does this is embedded in a complex
    asynchronous program.

    The idea is that you need to POST the username and password just like the
    browser does. You will find that a downside is that the browser sends
    name/value pairs, where the name is the name of the control to which the
    value applies, like username=john. An issue is that in ASP.NET, the name is
    likely to be something compound, like _ctl0:_ctl1:username. The numbering of
    the _ctln names is likely to change over time as the form is maintained, so
    your code will either have to change when the login page changes, or else
    try to guess what the names are by looking at the form.

    FYI, the way a login sequence usually works in Forms Authentication is:

    1. Client requests: GET desiredPage.aspx
    2. Server responds with a "302 Page moved" response, giving the location of
    the login page:
    3. Client requests the login page with a GET
    4. Server responds with the login page, which includes the form fields
    you'll need to fill in
    5. Client sends the username/password with a POST to the login page
    6. Server responds with a "302 Page moved" response, giving the location of
    desiredPage.aspx and also a login cookie
    7. Client requests desiredPage.aspx with a GET, including the login cookie,
    and this time it succeeds

    I hope this helps, and I'm sorry my code wouldn't help you much.
    --
    John Saunders
    Internet Engineer
    [email]john.saunders@surfcontrol.com[/email]


    John Saunders Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139