Nayan
Nayan

Reputation: 327

MVC router throws invalid character in the URL

I am using the below route in MVC3 application

context.MapRoute("RoutName", "GetReport/{Id1}/{Id2}/{requestId}/{customerId}/
{CustomerVersion}/{Code}", new {controller= "ControllerName",action = "GetReport" });

This route works fine for below URL in the local environment

http://localhost/ControllerName/GetReport/104334/120531211240541002/120531211240551002
/120531211237331002/1/Code

But in the server i am getting "Access Blocked due to invalid characters in URL". Is there restriction on the length of the URL in MVC?

Any input would be great.

Upvotes: 1

Views: 584

Answers (1)

Marthijn
Marthijn

Reputation: 3392

I have implemented your code in an empty MVC3 project but I'm not able to trigger your error, here the code just works fine.

ActionLink:

@Html.ActionLink("Test", "GetReport", "Home", new { Id1 = 104334, Id2 = 120531211240541002, requestId = 120531211240551002, customerId = 120531211237331002, CustomerVersion = 1, Code = "Code" }, null)

ActionResult:

public ActionResult GetReport(string Id1, string Id2, string requestId, string customerId, string CustomerVersion, string Code)
        {
            return new EmptyResult();
        }

What's different in your version?

Upvotes: 1

Related Questions