I have a simple action:
public ActionResult CommentError(string error)
{
return View(error);
}
I have a simple partial view called CommentError.ascx:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<String>" %>
<%: Model %>
When I browse to the view directy by going to myurl.com/find/Comments/CommentError the view displays fine… no errors.
But, when I go to myurl.com/find/Comments/CommentError?error=SomeErrorString, instead of binding the querystring to string error, it looks for a view called SomeErrorString.ascx.
Why is this happening?
Edit
Note, i do have a custom global.asax as indicated by the paths I’m using (/find/Comments/CommentError ::: /find/{controler}/{action})
As mentioned, MVC is looking for a view named the same as the string parameter. To avoid this, you need to cast it to an object…