Going to a link but need to log in.

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.
 
G

Gregory A. Beamer

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
 
M

Muj Beg

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
 
M

Mr.Magic

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?
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top