Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 02, 2012 10:19 PM by CPrakash82
Member
13 Points
56 Posts
Nov 02, 2012 12:25 PM|LINK
After a user logs in to my ASP.NET 4 website, I redirect them to an suitable ASP.NET MVC 'Area' based on their role.
return RedirectToAction("Index", "Customers", new { area = "CustomerProfiles" })
However, I need to check whether an area (i.e CustomerProfiles) actually exists before I peform the redirect?
Is it possible to do this somehow?
All-Star
134960 Points
21632 Posts
Moderator
MVP
Nov 02, 2012 12:42 PM|LINK
As I know MVC does not support dynamic Areas. Are you using something else?
Nov 02, 2012 01:01 PM|LINK
Essentially I just need to check whether my route is valid before I use the redirect. Is this possible?
Thanks
18284 Points
2841 Posts
Nov 02, 2012 10:19 PM|LINK
Do you think, T4MVC will help you, this will avoid string literals and you will be sure that the required areas, controller and action exists.
return RedirectToAction(MVC.CustomerProfiles.Customers.Index())
or may be similar syntax.
cjjubb
Member
13 Points
56 Posts
Checking whether a route is valid
Nov 02, 2012 12:25 PM|LINK
After a user logs in to my ASP.NET 4 website, I redirect them to an suitable ASP.NET MVC 'Area' based on their role.
return RedirectToAction("Index", "Customers", new { area = "CustomerProfiles" })However, I need to check whether an area (i.e CustomerProfiles) actually exists before I peform the redirect?
Is it possible to do this somehow?
ignatandrei
All-Star
134960 Points
21632 Posts
Moderator
MVP
Re: Checking whether a route is valid
Nov 02, 2012 12:42 PM|LINK
As I know MVC does not support dynamic Areas. Are you using something else?
cjjubb
Member
13 Points
56 Posts
Re: Checking whether a route is valid
Nov 02, 2012 01:01 PM|LINK
Essentially I just need to check whether my route is valid before I use the redirect. Is this possible?
Thanks
CPrakash82
All-Star
18284 Points
2841 Posts
Re: Checking whether a route is valid
Nov 02, 2012 10:19 PM|LINK
Do you think, T4MVC will help you, this will avoid string literals and you will be sure that the required areas, controller and action exists.
return RedirectToAction(MVC.CustomerProfiles.Customers.Index())
or may be similar syntax.