tags:

views:

55

answers:

1

Hi,

When a user logs on, I check if there is a return url, and if so I redirect to it, as per the MVC application template.

if (!String.IsNullOrEmpty(returnUrl))
{          
    return Redirect(returnUrl);
}

How would I check if this URL was valid (routes to a controller/action), and the user has permission to access it? My actions are all protected using the standard authorize attribute.

Thanks for your help,

Stew

A: 

You would normally protect a specific URL via the web.config file not inside your code. See this article.

James
I'm not trying to protect urls (which is done by using the mvc authorize attribute), just present a different pretty page to 'you do not have permission to access this url', but only for when a user first logs on, in the (albeit unlikely) event they have a return url set to an area of the site they don't have permission to access.
stew