I' m creating a community website but when i click on the links for example Find Users the page wont display it shows the following error can someone help
Here is my routes and the user control that returns the view
public
ActionResult Invitations()
{
if (IsUserAuthenticated)
{
return RedirectToAction("View",
"Invitations");
}
else
{
return RedirectToAction("View",
"Login");
}
}
routes.Add(
new
Route("User/Invitations",
new
MvcRouteHandler())
{
Defaults =
new
RouteValueDictionary(new
{
controller = "User",
action =
"Invitations"
})
}
);
The RouteData must contain an item named 'action' with a non-empty string value.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The RouteData must contain an item named 'action' with a non-empty string value.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[InvalidOperationException: The RouteData must contain an item named 'action' with a non-empty string value.]
System.Web.Routing.RouteData.GetRequiredString(String valueName) +187
System.Web.Mvc.Controller.ExecuteCore() +90
System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +23
System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +7
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContextBase httpContext) +108
System.Web.Mvc.MvcHandler.ProcessRequest(HttpContext httpContext) +39
System.Web.Mvc.MvcHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext httpContext) +7
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +404
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +76
Is that the only route you have? If a request is made for Login, then no route will match, since the route you showed will only match the Invitations action.
Phil Haack (http://haacked.com/)
Senior Program Manager, Microsoft
sasalee21
Member
9 Points
20 Posts
Error displaying Mvc Content Page
Dec 26, 2008 01:44 PM|LINK
I' m creating a community website but when i click on the links for example Find Users the page wont display it shows the following error can someone help
Here is my routes and the user control that returns the view
public ActionResult Invitations(){
if (IsUserAuthenticated){
return RedirectToAction("View", "Invitations");}
else{
return RedirectToAction("View", "Login");}
}
routes.Add(
new Route("User/Invitations", new MvcRouteHandler()){
Defaults =
new RouteValueDictionary(new{
controller = "User",action =
"Invitations"})
}
);
The RouteData must contain an item named 'action' with a non-empty string value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The RouteData must contain an item named 'action' with a non-empty string value.
Source Error:
Stack Trace:
Cohen Asaf
Member
236 Points
109 Posts
Re: Error displaying Mvc Content Page
Dec 28, 2008 05:53 AM|LINK
Hi,
Could it be that you have a code mixup?
The ActionResult functions should be in the Controllers and the Routing should be done in the Global.asax class.
But here you add Routing code to the Controller.
sasalee21
Member
9 Points
20 Posts
Re: Error displaying Mvc Content Page
Dec 30, 2008 09:21 PM|LINK
i have everyhting where it's supposed to be but i gwt the error
Augi
Contributor
6730 Points
1142 Posts
Re: Error displaying Mvc Content Page
Dec 30, 2008 10:39 PM|LINK
And why do you add new route?
Haacked
Contributor
6901 Points
412 Posts
Re: Error displaying Mvc Content Page
Dec 31, 2008 10:33 PM|LINK
Senior Program Manager, Microsoft
What wouldn’t you do for a Klondike bar?