Last post Mar 22, 2007 02:39 PM by MrRyansan
Mar 21, 2007 06:17 PM|MrRyansan|LINK
I have page A, and page B. When an outside user comes to page A, I want a module to do a certain security check and if they fail then redirect them someplace else, otherwise send them to their desired destination (page A).
That is fine, I can see how to use an HTTPModule for that. However, I want to do the same thing when page A tries to access page B. The problem is.... page B is on another server and I can't touch that page. Is there any kind of HTTPModule type thing I can
put in place so that when a user clicks a link on page A to go to page B, it can capture that, do the security check I mentioned, and then send them off to Page B if all is well? (or redirect if not)
I wanted a module type of thing so I can reuse it across multiple pages easilly... just tack it on.
Thanks! Any help is greatly appreciated.
Mar 21, 2007 09:56 PM|docluv|LINK
You might want to create an httpHandler and route the link through the handler, where your security check would be done.
<a href="mysecuritycheck.ashx">Page B</a>
Mar 21, 2007 09:58 PM|docluv|LINK
<a href="mysecuritycheck.ashx?desturl=pageb.aspx">Page B</a>
You would need to URLEncode the full URL.
Mar 22, 2007 03:07 AM|upgView|LINK
I think this is not secure solution. When user did visit page B, he can remember it and, later he can directly visits it, how can you stop him.
But if you really want to control user's click on page A to go to page B, you simply add a link button on page A, and hanle when user click on that link.
Hope this helps.
Mar 22, 2007 02:39 PM|MrRyansan|LINK
The handler may actually be the way to go for me. However, I want to be able to do two things:
1. Use the link method where I pass a querystring parameter into the handler .ashx page.
2. Register pages in the Web.Config file to use this handler as well.
Is this possible? Or can you only register handlers in the web.config file that are compiled DLLs?
In that case maybe I need to have a DLL handler (for mapping pages to in the web.config), and then have the .ashx page inherit from that handler so that it can be used within links.
Please let me know your thoughts!