Id with / causes problems with routing [duplicate]


Id with / causes problems with routing [duplicate]



This question already has an answer here:

I'm playing around with Raven DB and MVC 2. By default, the id in Raven will be e.g. "suggestions/1234" for an entity called Suggestion.

This causes problems with routing when I write like this:

<%: Url.Action("Delete", "Suggestion", new { id = suggestion.Id }) %> 

The url will be /Suggestion/Delete/suggestions/14337 which won't work.

Can this be solved in the routing, or do I have to change the format of the id in Raven? And how do I do that?


Blank LogOn view in MVC application

1:

return a list of string as JSONResult
Change your route from {controller}/{action}/{id} to {controller}/{action}/{*id}. What is the best practice for displaying the contents of a DataSet in ASP.net MVC v1.0?This is called a "catch-all" route; more details on MSDN.. How to use TextBoxFor to update the many side of a relationship Alternatively, you could pass the id as a query parameter.. looking for suggestions on how i can highlight areas on an image
Wanting to mix server side ASP.Net MVC expansion in javascript file, but how… RenderPartial?Problem with Primary Key in a Partial View shared by Create and Edit views

2:

How to start a new ASP.NET MVC site?
You will not be able to encode the forward slash by default.. Change the id to suggestions_1234 or try to use this setting:.
<uri>      <schemeSettings>         <add name="http" genericUriParserOptions="DontUnescapePathDotsAndSlashes" />     </schemeSettings> </uri> 
I did not check if the config setting works yet. And I can't did it right now for the reason this the soccer starts in 5min.. http://stackoverflow.com/questions/591694/url-encoded-slash-in-url.


60 out of 100 based on 30 user ratings 760 reviews

@