开发者

MVC2 Slash char in url

I want to use encrypted strings in MVC2 urls. A typical url in my app looks like this:

http://localhost:29558/Account/PasswordReset/ZKGeDMZikfIsnO8/MEs7SCBlI+MZo1Je8LM5dTEeCt3u91ARPUcavT5UXfVVRfyE

Note that eve开发者_开发问答rything after PasswordReset/ is the encrypted string. In the example the encrypted string contains a slash, and this is causing MVC to crash.

I've tried adding a MapRoute in Global.asax.cs as follows:

routes.MapRoute(
                "PasswordResetSpecialCase", // Route name
                "Account/PasswordReset/*", // URL with parameters
                new { controller = "Account", action = "PasswordReset" } // Parameter defaults
            );

but MVC2 is still falling over because the encrypted string contains a slash char. If I remove the slash then it works, but obviously that's no good. How do I get MVC2 to regard everything after the PasswordReset as pure data? Thanks.


Your maproute contains an error. Replace the * with {*nameOfParameter}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜