Going to a link but need to log in.

Discussion in 'ASP .Net' started by Mr.Magic, Jul 8, 2009.

  1. Mr.Magic

    Mr.Magic Guest

    I am going to put up a website with documents where we give our customers a
    link to go directly to the document. For safety purposed, I'm going to do
    Forms Authentication. The question I have though is if I give somebody a
    link to www.itsme.com/WinningLottoNumbers.pdf, it will force them to log in,
    just like it should. But once I am done having them log in, how can I direct
    the system to WinningLottoNumber.pdf? I don't want them to have to log in
    and then do the link again.

    Thanks for your help.

    Jeff.
    Mr.Magic, Jul 8, 2009
    #1
    1. Advertising

  2. "Mr.Magic" <> wrote in
    news::

    > I am going to put up a website with documents where we give our
    > customers a link to go directly to the document. For safety purposed,
    > I'm going to do Forms Authentication. The question I have though is if
    > I give somebody a link to www.itsme.com/WinningLottoNumbers.pdf, it
    > will force them to log in, just like it should. But once I am done
    > having them log in, how can I direct the system to
    > WinningLottoNumber.pdf? I don't want them to have to log in and then
    > do the link again.



    AFAIK, setting up forms authentication is all you have to do to get this
    going. You may have to register the MIME type in IIS, but that should be
    done with newer versions of IIS already. I have not tested this, but the
    normal ASP.NET login should work with PDF files.

    If it will not automatically redirect, you can use the redirect method
    back to the PDF file. It should not force the person to re-login unless
    the file itself does not give proper permissions to the ASP.NET account.
    This can happen if you move rather than copy files from another
    directory where the permissions are locked down.

    I posted a blog entry on permissions today: http://snurl.com/mdbhl


    --
    Gregory A. Beamer
    MVP; MCP: +I, SE, SD, DBA

    Twitter: @gbworld
    Blog: http://gregorybeamer.spaces.live.com

    *******************************************
    | Think outside the box! |
    *******************************************
    Gregory A. Beamer, Jul 8, 2009
    #2
    1. Advertising

  3. Mr.Magic

    Muj Beg Guest

    If you are using Forms Authentication, then you can just call the static
    method:

    FormsAuthentication.RedirectFromLoginPage()

    However, please note that your assumption that a request for
    http://mydomain.com/myfile.pdf will cause Forms Authentication to
    automatically kick in in incorrect!

    Under fedault IIS settings, the PDF file will be server by IIS natively,
    and ASP.NET pipeline will not be used, so your authentication code will
    never take place. (Please see various documentation available on how to
    resolvethis case.)

    Thanks,
    Muj Beg

    "Mr.Magic" <> wrote in message
    news:...
    >I am going to put up a website with documents where we give our customers a
    >link to go directly to the document. For safety purposed, I'm going to do
    >Forms Authentication. The question I have though is if I give somebody a
    >link to www.itsme.com/WinningLottoNumbers.pdf, it will force them to log
    >in, just like it should. But once I am done having them log in, how can I
    >direct the system to WinningLottoNumber.pdf? I don't want them to have to
    >log in and then do the link again.
    >
    > Thanks for your help.
    >
    > Jeff.
    >
    Muj Beg, Jul 9, 2009
    #3
  4. Mr.Magic

    Mr.Magic Guest

    Thanks everybody for the help. I guess my question is once the person has
    logged in, how do I know what the name of the file that was requested?

    "Muj Beg" <> wrote in message
    news:...
    > If you are using Forms Authentication, then you can just call the static
    > method:
    >
    > FormsAuthentication.RedirectFromLoginPage()
    >
    > However, please note that your assumption that a request for
    > http://mydomain.com/myfile.pdf will cause Forms Authentication to
    > automatically kick in in incorrect!
    >
    > Under fedault IIS settings, the PDF file will be server by IIS natively,
    > and ASP.NET pipeline will not be used, so your authentication code will
    > never take place. (Please see various documentation available on how to
    > resolvethis case.)
    >
    > Thanks,
    > Muj Beg
    >
    > "Mr.Magic" <> wrote in message
    > news:...
    >>I am going to put up a website with documents where we give our customers
    >>a link to go directly to the document. For safety purposed, I'm going to
    >>do Forms Authentication. The question I have though is if I give somebody
    >>a link to www.itsme.com/WinningLottoNumbers.pdf, it will force them to log
    >>in, just like it should. But once I am done having them log in, how can I
    >>direct the system to WinningLottoNumber.pdf? I don't want them to have to
    >>log in and then do the link again.
    >>
    >> Thanks for your help.
    >>
    >> Jeff.
    >>

    >
    Mr.Magic, Jul 16, 2009
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Henrik_the_boss
    Replies:
    0
    Views:
    2,643
    Henrik_the_boss
    Nov 5, 2003
  2. Amratash
    Replies:
    0
    Views:
    515
    Amratash
    Apr 13, 2004
  3. Kevin Spencer

    Re: Link Link Link DANGER WILL ROBINSON!!!

    Kevin Spencer, May 17, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    808
    Kevin Spencer
    May 17, 2005
  4. AAaron123
    Replies:
    1
    Views:
    273
    Cowboy \(Gregory A. Beamer\)
    Oct 14, 2008
  5. Jiong Feng
    Replies:
    1
    Views:
    181
    Lasse Reichstein Nielsen
    May 15, 2004
Loading...

Share This Page