Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8114939
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T03:18:26+00:00 2026-06-06T03:18:26+00:00

I have an MVC application created from the Internet template to use forms authentication,

  • 0

I have an MVC application created from the Internet template to use forms authentication, when the user has logged on I want to direct them, say, to the Home|About page.

The LogOn method is that created by the project template, without modification;

    [HttpPost]
    public ActionResult LogOn(LogOnModel model, string returnUrl)
    {
        if (ModelState.IsValid)
        {
           // etc, etc
        }

        return View(model);
    }

I’ve set the defaultUrl in Web.config as follows;

<authentication mode="Forms">
  <forms loginUrl="~/Account/LogOn" timeout="2880" defaultUrl="~/Home/About"/>
</authentication>

However, when HomeController.LogOn is called the returnUrl parameter is always null. Note the HttpPost attribute on the LogOn method, so the url cannot be passed in the query string.

How can I configure a return url so it gets passed to the LogOn action method and the user is directed to the url’s location after log on?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T03:18:27+00:00Added an answer on June 6, 2026 at 3:18 am

    Easiest way is to change the default route in the Global.asax to point to /Home/About instead of /Home/Index

    public static void RegisterRoutes(RouteCollection routes) {
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
        routes.IgnoreRoute("{*favicon}", new { favicon = @"(.*/)?favicon.ico(/.*)?" });
    
        routes.MapRoute(
            "Default", // Route name
            "{controller}/{action}/{id}", // URL with parameters
            new { controller = "Home", action = "About", id = UrlParameter.Optional } // Parameter defaults
        );
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created blank Asp.Net-MVC 3 web application and want to write my own
i have created a MVC application , without using asp.net membership provider, i want
I have created an ASP.NET MVC application and am trying to use Castle Windsor
I have learned from the sencha doc how to create a simple MVC application,
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating.
I have created an multi thread application on IIS (ASP.NET MVC), When the threading
I created a simple ASP.NET MVC version 1.0 application. I have a ProductController which
I have an ASP.NET MVC 3 application which has a post action called Create
I have installed VS 2010 and created a new MVC application with it. I
I have created an ASP.Net MVC Web Application and used NuGet to install Ninject

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.