Going to a link but need to log in.

  • Thread starter Thread starter Mr.Magic
  • Start date Start date
M

Mr.Magic

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.
 
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! |
*******************************************
 
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
 
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?
 
Back
Top