I have a web app with some restricted aspx pages and my security check is being done by the master page of the aspx pages. (not sure if this is a great idea). my problem is if there is no logged in user or he does have the required rights, i forward to a No-Rights error page. I want to specify this page relative from web-app root. This is important to have portable code (locally pages are at localhost/Project-Name/Restricted/etc..., while on server they are at host/Restricted/etc...) Someone suggested the ~ option, but this does not work in code behind - it only works in aspx pages. My security checks, of course, are done in the code behind. any help?
C
Colin Pace
@Colin Pace
Posts
-
path urls relative to root of web app -
Relative URLs in Code-BehindHi, I am implementing a mechanism that check a user is logged in before showing the aspx pages. I have tried to implement this in the code behind of the master page of the restricted pages. In case there is no-one logged in the page must redirect to the appropriate "No-Rights" page. The problem is that the master page can be used by pages at different folder levels. How to redirect the response to the correct URL of the page? How to specify the URL relative from the web-application root? Another typical problem here is that when debugging using Visual Studio, the pages are relative to the localhost/PROJECT-NAME/pages. But when deployed the pages are placed directly under HOST/pages. Can anyone help? Thanks, Colin