tags:

views:

16

answers:

1

Hi,

Developing an application using MVC-style extensionless URL's. One of the pages has a url that sometimes contains an email address. On my local machine this works fine. However when I publish to the test server, trying to access this URL yields a 404 error, unless you take the full stop out, in which case it routes as expected.

I've tried adding this to the web.config file:

    <httpRuntime relaxedUrlToFileSystemMapping="true"/>

But it has no effect

Any ideas what might be causing this? Even if I could find a more helpful error than just a 404 it'd be a start!

Cheers, Matt

A: 

First thanks as your question set me looking at something that it was on my todo list to solve for myself. Second, while I was looking at that, I came across the requestPathInvalidChars attribute of the httpRuntime config element which looks like it should be what you want here (and what I want elsewhere).

Jon Hanna
Thanks for the suggestion - but it seems as though . isn't an invalid character as standard!
Matt Thrower
Reading more for my own purposes, I see this property is for ASP.NET version 4 only, which rules it out for me, and may have done for you. Meanwhile, is it period characters anywhere in the URI that's a problem? I've only ever found it an issue at the end of the path.
Jon Hanna
It's anywhere - I knew they were restricted at the end of the path. But this blows up for me: www.mysite.com/myroute/[email protected] .. and this doesn't www.mysite.com/myroute/mattthrower@herecom .. I can work round it by moving it to a querystring, but it's still a curious problem and I'd be interested to see a solution.
Matt Thrower
Could it be combination of the @ rather than the ., considering that @ is a character with meaning elsewhere in URIs (not in HTTP URIs as the `user[:pass]@` portion of the URI is not allowed in HTTP URIs by the standard, but is part of the standard for URIs themselves). I know you say @ is allowed, but what about . without @ maybe its a combo of the two that has issues? (at this point I'm assuming my answer above is no good, but might as well explore the problem space more here in the comments).
Jon Hanna
Nope. it's just the full stop. Nice idea though! And I am using .net 4 but changing the config element you suggested won't work because . is already in the allowed list. It's particularly odd that this works when run locally - makes me think it must be an IIS setting somewhere rather than a code issue.
Matt Thrower