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

  • SEARCH
  • Home
  • 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 3606888
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:18:22+00:00 2026-05-18T21:18:22+00:00

I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which

  • 0

I have created a new MVC2 project using the ASP.NET MVC2 Web Application, which gives me the default web site. I have added a simple area in which I had a Home Controller and an Index view. That cuased the first problem with the compiler giving “Multiple types were found that match the Controller name ‘Home'”. I changed Home to Main and it compiled.

I added a new tab to reference the Index view in my area, opened the website and started clicking the tabs. When I visited the Area index page, I couldn’t go back to the Home or About page without changing the menu, as follows:

<ul id="menu">              
     <li><%= Html.ActionLink("SampleArea.Main", "Index", "Main", new { area = "SampleArea" }, null)%></li>
     <li><%= Html.ActionLink("Home", "Index", "Home", new { area = "" }, null)%></li>
     <li><%= Html.ActionLink("About", "About", "Home", new { area = "" }, null)%></li>
</ul>

I could then cycle through the tabs correctly. I then changed the code in the LogOff view in the Account controller, as follows:

public ActionResult LogOff()
{
    FormsService.SignOut();

    //return RedirectToAction("Index", "Home");
    return RedirectToAction(Request.UrlReferrer.AbsolutePath.ToString());
}

I am using UrlReferrer.AbsolutePath to return to the calling page if the User logs off. If the calling page happens to be the View in SampleArea, .AbsolutePath contains “/SampleArea”. This is because the controller and view are the defaults, and so they are not included. As it continues, I get the following error message:

The resource cannot be found.
Description: HTTP 404. The resource
you are looking for (or one of its
dependencies) could have been removed,
had its name changed, or is
temporarily unavailable. Please
review the following URL and make sure
that it is spelled correctly.

Requested URL: /Account/SampleArea

My understanding is that /Account has been added because that is the controller it was in when LogOff was executed. It thinks /SampleArea is an action and therefore added the current controller to complete the route.

Using UrlReferrer.AbsolutePath, is there any way I can specify SampleArea as an area, or is there something else I can do to return to the correct page?

New Addition
This is even stranger than I thought. I opened the website I am currently developing and changed the return statement in view LogOut to return using AbsolutePath. A breakpoint reveals it contains “/Club/PrivacyPolicy”. However, I get the same error message with the following difference:

Requested URL: /Login/Club/PrivacyPolicy

Why on earth should it prefix it with /Login which is a View, rather than /Account which is a Controller? In fact, why should it prefix it with anything at all? /Club/PrivacyPolicy
is a valid route in Global.asax.cs.

  • 1 1 Answer
  • 1 View
  • 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-05-18T21:18:23+00:00Added an answer on May 18, 2026 at 9:18 pm

    I have finally figured out how to return to the page you were on when you triggered the LogOn or LogOut request. I have used the following piece of code.

    Html.ActionLink("Member LogOn", "LogOn", "Account", new { area = "", returnUrl = HttpContext.Current.Request.RawUrl }, null)
    

    This generates

    <a href='/LogIn/LogOn?returnUrl=%2FContactUs'>Member LogOn</a>
    

    for example.

    In my HttpPost ActionResult LogOn, I then have

    if (!String.IsNullOrEmpty(returnUrl))
    {
        return Redirect(returnUrl);
    }
        else
    {
        return RedirectToAction("Index", "Home");
    }
    

    Sometimes I find I just need HttpContext.Request.RawUrl.

    I’m not quite sure why it has generated /LogIn/LogOn instead of /Account/LogOn, but it works as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web application which was using Asp.net MVC2 . I Upgraded it
I have created a new ActionFilter for an ASP.NET MVC application that I'm creating.
I have an IIS7.5 web-site, on Windows Server 2008, with an ASP.NET MVC2 web-site
I have created a new application using Entity Framework 4.3 database migrations. The migrations
I am starting a new project in Asp.net MVC 2. I have been mostly
I'm new to ASP.NET MVC, and plan on using it for an upcoming project.
I have a new MVC-2 project where I added the area 'member'. I created
I have an ASP.NET application which works just fine, but which is becoming unwieldy.
I've created an ASP.NET MVC 2.0 application. I have a dropdownbox with a list
So I am very new to web development and have a .NET MVC site

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.