ASP.NET MVC The new ActionLink with MvcHtmlString and request URL generated

Posted by mare on Stack Overflow See other posts from Stack Overflow or by mare
Published on 2010-03-19T14:00:36Z Indexed on 2010/03/19 14:01 UTC
Read the original article Hit count: 435

Filed under:
|

This piece of code used to work in MVC 1 but it does not since I upgraded to MVC 2:

    <%=Html.ActionLink(Resources.Localize.Routes_WidgetsCreate, "Create" + "?modal=true", "Widget", null,
                                      new
                                        {
                                            rel = "shadowbox;height=600;width=700",
                                            title = Resources.Localize.Routes_WidgetsCreate
                                        })%>

I am aware it has something to do with the way ActionLink encodes things, so the result that comes out is something like this:

"http://localhost:53704/Widget/Create%3fmodal%3dtrue"

The problem is, when clicked, the Shadowbox modal opens up and inside, where the request View should be rendered is this exception:

Server Error in '/' Application.

A potentially dangerous Request.Path value was detected from the client (?).

What can I do to get past that? Do you recommend another way of sending params to the view besides in QueryString (in this case I need "modal" because in the view I select CSS styles based on whether we are rendering modal or not)?

© Stack Overflow or respective owner

Related posts about asp.net-mvc-2

Related posts about asp.net-mvc