Basically, Asp.net MVC has some hidden features. For example, when you pass the variable "id" to a controller action, it interprets "id" as the default identifier and places it in the browser request with a slash. Using a different name instead of "id", we will see '?' not a slash. Due to setting the name 'id' in the RegisterRoutes method in the global.asax file.
In this task, you created a custom data proxy controller using this code:
using(Html.BeginForm("LogOn", "Account", FormMethod.Post)) {
So, Asp.net MVC ignores other useful data to go to the controller action, and we will see returnUrl always null .
Although using this, Asp.net MVC acts correctly and returnUrl is mounted:
using(Html.BeginForm()) {
By the way, when we use user data skips for controller actions, it is necessary to transfer other data manually as follows:
using(Html.BeginForm("LogOn", "Account", new {ReturnUrl = Request.QueryString["ReturnUrl"] })) {
Amirhossein Mehrvarzi Jul 21 '13 at 12:57 on 2013-07-21 12:57
source share