I have a folder with several .aspx pages that I want to restrict access to. I added web.config to this folder with <deny users="?"/>.
The problem is that ReturnUrl is automatically generated with the physical path to the .aspx file, while I am using UrlRewrite.
Is there a way to manipulate ReturnUrl without manual authentication and redirection? Is there a way to set ReturnUrl from code or from web.config?
EDIT . The application uses WebForms ASP.NET 2.0. I can not use 3.5 routing.
EDIT 2 : It seems that status code 401 is never written. It returns 302 for the secure page and redirects the login page using ReturnUrl. It does not return 401 for the secure page. Hmm ... Interesting ... Link: http://msdn.microsoft.com/en-us/library/aa480476.aspx
This complicates the work ... I may need to write rewrite rewriting rules for the regular expression match ReturnUrl and replace it if it does not return 401 ... If it returns 401, I can either set RawUrl to Response.RedirectLocation or replace ReturnUrl with RawUrl.
Does anyone have any other ideas?
source
share