SharpCoder
SharpCoder

Reputation: 19193

ASP.NET MVC url with null value is not working with IE but works with FireFox

I am making an Ajax call to ASP.NET MVC endpoint. The url is something like this (Last parameter is null):

/employee/GetAllEmp/connID/Sale Dept/Month/Year/week/null?_dc=1371101563256

Server side:

 public ActionResult GetAllEmp(string connID, string deptName, string month, string year, string week, string data)

When my application send request through IE, the endpoint at the server side is not called but when same request is being made through fire fox, system is able to call correct method.

What could be the reason? I googled around but could not find any answer :(

Please provide your suggestion.

Thank you

Upvotes: 0

Views: 149

Answers (1)

Stokedout
Stokedout

Reputation: 11055

Based on what parameters your action method expects then /null will be parsed as a string literal rather than true null.

If this data is empty you should skip it completely and make your route accept an optional parameter

Upvotes: 1

Related Questions