1

I have a page with several Update Panels on it. the url of that page is: http://[domainnamehere]/stores/

If I omit the trailing slash, everything works fine. if I include it, when the page does an asynchronous postback, it goes to http://[domainnamehere]/stores/stores

Not sure why that's happening, but its sure a pain in the butt! Any suggestions would be most welcome.

Dylan
  • 31
  • 4

1 Answers1

2

Your problem is on the server-side. You need to configure the route to your resource to accept the trailing slash. If you are using MVC you should be able to add a slash to that route, if not it will require URL rewriting at the IIS level.

marteljn
  • 6,446
  • 3
  • 30
  • 43
  • Marteljn, thanks for your quick answer. i'm certain you're right, what i'm not sure of is how to go about configuring my route to accept the trailing slash. I thought i already had by putting the trailing slash in the route: 'routes.Add("LocatorRoute2", new Route("Stores/", new CustomRouteHandler("/Locator.aspx")));' – Dylan Jun 15 '12 at 18:28
  • Did a little more googling and apparently this is a fairly coomm complaint without a good solution. http://stackoverflow.com/questions/1027027/why-is-asp-net-mvc-ignoring-my-trailing-slash, this post points to a blog that discusses how to fix it using URL rewriting (assuming you are using IIS7). There are ISAPI filters for IIS6 that should be able to accomplish the same thing. – marteljn Jun 15 '12 at 18:36
  • Thanks, i don't feel quite so dumb if nobody else can completely solve it either :) – Dylan Jun 15 '12 at 18:39
  • You could also in the `Application_BeginRequest` event of the Global.asax, do a redirect if the request path ends with a slash, but that is a hack. But it may be the easiest fix. – marteljn Jun 15 '12 at 18:40