Why does ReturnUrl return null parameter though it shows up in the adress bar?

Why does ReturnUrl return null parameter though it shows up in the adress bar?

What could be the reason for&nbsp;<strong>returnUrl</strong>&nbsp;string getting back asthe null value though it's printed in the adress bar. In he form I've created hidden input tag in order to catch URL and pass it into the ActionResult parameter :

What could be the reason for returnUrl string getting back asthe null value though it's printed in the adress bar. In he form I've created hidden input tag in order to catch URL and pass it into the ActionResult parameter :

    @using (Html.BeginForm("Login", "Account", FormMethod.Post, ))
        {
                 @Html.AntiForgeryToken()
                 <input type="hidden" value="@Url.RequestContext.HttpContext.Request.QueryString["ReturnUrl"]"/>
               <input type="submit" value="Enter" class="btn btn-primary"/>
        }

So after hitting submit button I'm redirected to the Account controller/ Login ActionResult with the ReturnUrl parameter being null

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult Login(LoginModel model,string ReturnUrl)
        {

        if (ModelState.IsValid)
        {
           //some codes
                if (String.IsNullOrWhiteSpace(ReturnUrl))
                {
                    return RedirectToAction("HomeIndex", "Home");
                }
                else
                {
                    return Redirect(ReturnUrl);
                }
            }
            else
            {
                ModelState.AddModelError("UserLoginError", "Username or password is incorrect");
            }
        }
        return View(model);
    }

I've also tried to add the qerystring as a parameter inside the brackets of Beginform like this:

@using (Html.BeginForm("Login", "Account", FormMethod.Post, new { ReturnUrl = Request.QueryString["ReturnUrl"] } )) 

Didn't work either.

asp.net

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Hire ASP.Net Developers

Looking to outsource your asp dot net development requirement? ASP.Net is a special feature of the DOT Net framework created by Microsoft. At [HourlyDeveloper.io](https://hourlydeveloper.io/ "HourlyDeveloper.io"), we have a team of experienced...

Routing in MVC - ASP.NET Core Demystified

ASP.NET Core MVC has introduced quite a few concepts that new (or new-to-ASP.NET) web developers might have some difficulty getting caught up with. My ASP.NET Core Demystified series is designed to help these developers get started building their own custom, full-fledged, working AASP.NET Core applications. In

What is the ASP.Net Machine Account on my Computer?

Some users have reported the existence of the ASP.Net machine account. In this article, I will discuss what is asp.net machine account in windows 10/7 and how to disable it, asp.net machine account password, and can I delete asp.net machine account? .NET Framework is an application on Windows that requires the installation to run several apps or games. However, when the .NET Framework is downloaded and installed, the application automatically creates an ASP NET machine account.

ASP.NET Community Standup - ASP.NET Core Linker with David Fowler

David Fowler will be showing ASP.NET Core linker improvements on the way for .NET 5, and probably some other crazy experiments. Come join the fun! Community ...

Add asp.net Identity in empty project

LIKE | COMMENT | SHARE | SUBSCRIBE Today, in this tutorial you will see the process of adding an ASP.NET Identity to the ASP.NET Web Application developed in...