0

I am having below mentioned issue when I am running Asp.Net MVC 2 project on windows Azure emulator (dev environment)

enter image description here

My web.config files is as below :

<httpRuntime maxUrlLength="4096" relaxedUrlToFileSystemMapping="true" maxQueryStringLength = "4096" requestValidationMode="4.0" />

My URL with query string is as below :

http://www.pawloyalty.com:82/booking/camp-canine-doggy-daycare-and-boarding/cgillette/key/camp-canine-doggy-daycare-and-boarding-cgillette-20130103154022/pets/bailey/service/full-day-care/dates/2013-1-3%2b2013-1-4%2b2013-1-7%2b2013-1-8%2b2013-1-9%2b2013-1-10%2b2013-1-11%2b2013-1-14%2b2013-1-15%2b2013-1-16%2b2013-1-17%2b2013-1-18%2b2013-1-21%2b2013-1-22%2b2013-1-23%2b2013-1-24%2b2013-1-25%2b2013-1-28%2b2013-1-29%2b2013-1-30%2b2013-1-31%2b2013-2-1%2b2013-2-4%2b2013-2-5%2b2013-2-6%2b2013-2-7%2b2013-2-8%2b2013-2-11%2b2013-2-12%2b2013-2-13%2b2013-2-14%2b2013-2-15%2b2013-2-18%2b2013-2-19%2b2013-2-20%2b2013-2-21%2b2013-2-22%2b2013-2-25%2b2013-2-26%2b2013-2-27%2b2013-2-28%2b2013-3-1%2b2013-3-4%2b2013-3-5%2b2013-3-6%2b2013-3-7%2b2013-3-8%2b2013-3-12%2b2013-3-13%2b2013-3-14%2b2013-3-15%2b2013-3-18%2b2013-3-19%2b2013-3-20%2b2013-3-21%2b2013-3-22%2b2013-3-25%2b2013-3-26%2b2013-3-27%2b2013-3-28%2b2013-3-29/rtimes/7.5%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19%2b6%2b19/rextras-bailey/-?step=dates

Note : above having 1490 characters

My controller Action method's redirect is as below :

return RedirectToRoute("booking", new { action = "index", providerKey = providerKey, ownerKey = ownerKey, arguments = arguments, step = step });

Note : arguments having above query string details

How to get rid of this error page ?

Sampath
  • 63,341
  • 64
  • 307
  • 441
  • 1
    There are URL lengths limits, these vary between browsers. Your URL is abnormal of length – RvdK Jan 17 '13 at 12:23
  • @RvdK I set it as "maxUrlLength="4096"" in web.config file but still having same issue ? Any idea ? – Sampath Jan 17 '13 at 12:27
  • @Sampath there is url length set for per browser,IE only allows url of length 2083 characters – Cris Jan 17 '13 at 12:28
  • 1
    @Sampath this is not proper approach to pass data in URL,better use POST – Cris Jan 17 '13 at 12:29
  • @Sampath: this is serverside, the browser (on the client) does something different. – RvdK Jan 17 '13 at 12:32
  • @Cris Actually I am sending this data to my next action method ("index") ? There is not any post data here.Only GET ? – Sampath Jan 17 '13 at 12:32
  • you can avoid ugly URLs by sticking your values in TempData instead of the route. – Cris Jan 17 '13 at 12:34

1 Answers1

5

keep your URL length under 2000 characters or use POST method rather than GET

Cris
  • 12,799
  • 5
  • 35
  • 50
  • Actually I am sending this data to my next action method ("index") ? There is not any post data here.Only GET ? – Sampath Jan 17 '13 at 12:33
  • you can avoid ugly URLs by sticking your values in TempData instead of the route – Cris Jan 17 '13 at 12:36
  • Then Could you tell me why we set on web.config file ? Any Idea ? – Sampath Jan 17 '13 at 12:38
  • @Sampath it is mostly used for web services for REST API calls which happens without using browsers,each browser has their own cap over url length and IE is smallest of them – Cris Jan 17 '13 at 12:42
  • Yes good point.But my whole URL having 1490 characters.So then it should work know ? Any idea ? – Sampath Jan 17 '13 at 12:44
  • maybe one of the input parameter has some characters that violates the url specification,must be a maligned character present in url,refer this http://stackoverflow.com/questions/1547899/which-characters-make-a-url-invalid – Cris Jan 17 '13 at 12:49
  • No that is not the case here.B'cos my url maintained the above mentioned characters.My business Here is I am sending date kind of thing.when I select say 20 different dates it's working.When i am selecting around 50 dates it's not working.Any idea ? – Sampath Jan 17 '13 at 13:06
  • try converting the DateTime to Ticks and pass that number around. – Cris Jan 17 '13 at 13:22
  • Thanks for your support.I have used TempData for send my data.Then problem vanished. – Sampath Jan 19 '13 at 17:07