views:

153

answers:

3

Ok. This one must be silly: We have just migrated a project to Visual Studio 2010 (Release Candidate) + .Net 4 + MVC2. One of the reasons was that the customer has record IDs that include the "/" character, and using encoded slashes as route parameters was not allowed until .Net 4.

(See http://stackoverflow.com/questions/591694/url-encoded-slash-in-url for more info on that).

In theory, the following parameters in web.config sould do the trick:

<configuration>
   <appSettings>...</appSettings>
   <connectionStrings>...</connectionStrings>

   <uri>
       <schemeSettings>
            <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes"/>
       </schemeSettings>

   </uri>

<system.web>...</system.web>
<system.webServer>...</system.webServer>
<runtime>...</runtime>
</configuration>

As mentioned here: http://msdn.microsoft.com/en-us/library/bb882619%28VS.100%29.aspx

And here: https://connect.microsoft.com/VisualStudio/feedback/details/511010/erroneous-uri-parsing-for-encoded-reserved-characters-according-to-rfc-3986

However, the app keeps crashing when we try to access an URL such as: http://localhost:49979/Sales/Details/A%2f123

It was kind of expected because in the web.config the < add > tag is underlined in blue, and the following message appears when you hover over it: "The element 'schemeSettings' cannot contain child element 'add' because the parent element's model is empty".

Has anybody used that configuration parameter successfully? Do we need to configure anything else?

Note: we have migrated the project to the release candidates of VS2010/MVC2/.Net4 as a test. "Gold" releases of MVC2 and .Net4 should be available by the time the app goes into production, and we would rather configure .Net to accept encoded dashes, than trying to replace them with something else that might be used in IDs in the future (we can't control the characters that will be used as IDs in some of the tables of the app).

A: 

Hey There,

i'm having the same problem and no luck finding an answer!!

i guess i'll keep looking. Please write back if you have found the solution!

Regards,

Sebastian Andres

Sebastian
I haven't solved it yet, but I only tested it with the RC. If we manage to solve it (migrating to the final release of VS2010/.Net4, or otherwise), I'll add a comment here.
salgiza
A: 

Having a similar problem using the release versions of all the products mentioned above. Were you ever able to find a solution to this?

cbeckner
No. We continued with new requirements for the project and the client is not using IDs with dashes... for now. We'll have to investigate further in the future. If we solve the problem I'll post it here (and if you do solve it first, please post how!)
salgiza
A: 

I'm having the same problem as well. Haven't been able to find a solution on the web. Does anyone have a clue as to why this happens?

Knut Marius