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

The Archive Base Latest Questions

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

This is weird. I have a virtual directory setup for an MVC3 application called

  • 0

This is weird. I have a virtual directory setup for an MVC3 application called (for the sake of this question) I’ll call ‘foobar’. The full URL to this site is:

http://localservername.domainname.com/foobar

In my logon form, I have the following line that is supposed to redirect to the main/home page of the application after logon.

return RedirectToAction("Index", "Home");

However, when this line executes, I get redirected to the wrong location – so instead of redirecting me back to:

http://localservername.domainname.com/foobar

I get redirected back to:

http://localservername.domainname.com/foobar/foobar

Which of course gets me a resource not found error. Also, any links in my views seem to do the opposite – for example if I have a link like this:

<a href="/WidgetSearch">Widget Search</a>

I would expect the following URL to open:

http://localservername.domainname.com/foobar/WidgetSearch

Instead, I get redirected to

http://localservername.domainname.com/WidgetSearch

Which of course also gets me a resource not found error. I’ve never encountered this type of behaviour before. I’ve gone over the basic and advanced settings and created a new application pool. Fiddler also shows me that (of course) the URLs listed above return 404 responses.

Any suggestions would be greatly appreciated.
Thanks!

  • 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:48:03+00:00Added an answer on May 26, 2026 at 9:48 pm

    The first issue shouldn’t really happen. RedirectToAction should take into account your virtual directory path (you haven’t hard coded an extra /foobar into your route setup have you?).

    The second problem has nothing to do with MVC, it’s just that you’re using a vanilla HTML link that is pointing directly to the root of the server (that’s what saying /blah implies). You should change your link to use one of the MVC helper methods to generate the URL instead to make sure it adds the virtual directory for you. So one of the following (the first is probably the best way, unless you need to heavily customise what the anchor tag looks like):

    @Html.ActionLink("Widget Search", "Index", "WidgetSearch")
    

    or

    <a href="@Url.Action("Index", "WidgetSearch")">Widget Search</a>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been going through this weird issue on some of my virtual machines.
I have this weird problem with setting up cookies with PHP. Everything worked fine
This is a weird problem I have started having recently. My team is developing
This is pretty weird. I have my Profiler open and it obviously shows that
This could be weird, Have you ever come across a blog which you wanted
This one is weird, I have a page that consists of a html table
This is very weird. I have the following code: Assert.AreEqual(new DateTime(2000, 1, 1), DateTime.ParseExact(2000,
I have a weird grid with different height columns. By this I mean, column
I have a weird problem, and I don't know if this is the default
I know this one is the weirdest of all weird questions I have asked

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.