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 6819731
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:20:28+00:00 2026-05-26T21:20:28+00:00

I have been working on an MVC 3 app. I was using VS 2010’s

  • 0

I have been working on an MVC 3 app. I was using VS 2010’s built-in web server.

Today, for various reasons, I was asked to move it into a virtual directory and run it under IIS 7, still on my development PC.

Now that its URL is localhost/MyVirtualDirectory as opposed to localhost:12345, what do I need to change to make routing work, and where?

I’m not using any raw HTML anchor tags or redirects, just @Html.ActionLink and so on. According to what I’ve read, if I’ve been doing things the MVC way, this change should have been transparent.

But right at the beginning, the post-authentication redirection fails. On successful authentication, it’s supposed to return the result of

this.RedirectToAction("index", "Home")

You guessed it: instead of /MyVirtualDirectory/Home the redirection goes to /Home. Which fails.

So something is missing that needs to be set up. What is it?

  • 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-05-26T21:20:29+00:00Added an answer on May 26, 2026 at 9:20 pm

    In IIS, choose your virtual directory and “Convert to Application.” Also, if you are using the default route map in your Global.asax it should read something like this:

    routes.MapRoute(
        "Default", // Route name
        "{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
    );
    

    Reasoning: If you put your MVC application in a sub-directory of another application then IIS will consider the root of that other application instead of the root of your MVC application. If that is the behavior that you want (unlikely) then you need to modify your Global.asax to take that into account:

    routes.MapRoute(
        "Default", // Route name
        "MyVirtualDirectory/{controller}/{action}/{id}", // URL with parameters
        new { controller = "Home", action = "Index", 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 been working on this MVC 3 Razor app and typically utilize view
I have an MVC app that I have been working on but I seem
I have been working with an MVC app and creating Repositories that manipulate, validate,
For past projects(the last few have been web using asp.net mvc) we created a
I have been working my way through Scott Guthrie's excellent post on ASP.NET MVC
I have been working on a web services related project for about the last
I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
Had something weird start happening to me today. I have an asp.net mvc app
I have an asp.net MVC app that i am working on and I wrote
I have an ASP.NET MVC application that I'm working on. I've been developing it

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.