views:

622

answers:

2

I have an authentication script (CheckLogin.aspx), and if any of the credentials do not match my application will redirect (via Server.Transfer) to the access denied page (forbidden.aspx). Each time my script runs,it gets an InvalidOperationException: Failed to map the path '/forbidden.aspx'. Here is a mockup of my applications file structure:

<root>
..default.aspx
..forbidden.aspx
..<inc>
....scripts.js
..<auth>
....CheckLogin.aspx

As you can see, the CheckLogin.aspx page is in a folder inside the root, and the forbidden.aspx page is inside the root itself. The path I am telling my application to redirect to is /forbidden.aspx.

+3  A: 

Sometimes you have to precede the page path with a tilde to indicate the root directory:

'~/forbidden.aspx'
DOK
A: 

Are you using "~/..." to make sure all your paths are relative?

By the way, you should just set up page access via Web.config, by using the <location> tags. That way you can have some sort of role-based access, without much custom code.

Kon
The reason I am using this method is my webapp links with a platform application that communicate together.
Anders