Redirect all http requests to web application

B

Brian Smith

Good afternoon.

How can I force all images and static html files within an ASP.NET Web
Application to be redirected if the user has not logged in yet via Forms
Authentication.

For example, I have a web application name TestWebApp with Forms
authentication set to redirect to logon.aspx.

If I request http://HOST/TestWebApp/anything.aspx , I am redirected to the
logon.aspx.
If I requset http://HOST/TestWebApp/anything.gif, the image is returned. But
I want it to go to logon.aspx.

Thanks.
Brian Smith
 
K

Kevin Spencer

Hi Brian,

You could write a custom HttpHandler class to do this. Map all of your
requests for the various file types to your HttpHandler, and it will handle
the requests. It can then Redirect, or whatever, in response to a request
for a Resource such as a Page, image, etc.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top