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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T01:56:15+00:00 2026-05-25T01:56:15+00:00

I have an app setup that runs on a server where the url is

  • 0

I have an app setup that runs on a server where the url is rewritten to the app. it goes servername.com/myapp

I routed the app as follows:

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

So that it will always begin with “myapp” otherwise the server will redirect the url. Now the content can’t be found. I’ve tried putting the urls in manually but it doesn’t work.
Here’s what my view looks like:

<link href="@Url.Content("~/Content/themes/Site.css")" rel="stylesheet" type="text/css" />

Nothing strange about this so I don’t see why it shouldn’t work. Perhaps the server is rewriting the urls for content as well, so is there any way to set Url.Content() to map accordingly?

  • 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-25T01:56:16+00:00Added an answer on May 25, 2026 at 1:56 am

    I recently had the same problem. Here is what I used to solve it, although someone may find a somewhat easier way.

    On the development webserver, it used the server’s root which resolved as “/” and it resolved to “/appname” on the deployment webserver. I could hardcode to link to one, but it obviously failed for the other. The answer is to create strings that find it programmatically.

    @{
    string rootpath = HttpContext.Current.Request.ApplicationPath;
    if(rootpath != "/") { rootpath = rootpath + "/"; }// add closing slash if missing
    string contentpath = rootpath + "Content/themes/Site.css";
    }
    <link href="@contentpath" rel="stylesheet" type="text/css" />
    

    I put the rootpath code into a static function in a separate class since I used it on every page with links or images.

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

Sidebar

Related Questions

I have a setup project that installs my app to the typical program files
I have an Setup project that installs App.exe. App.exe depends on 1) A third
I have a MVC app and using JQuery. I have anchor that I setup
I am building an app that runs periodically and monitors server essentials (RAM, disk
This a bit of strange one.... We have an internal web app that runs
I have an expressjs app with everyauth setup. Everyauth is working fine. Now, I
I have an MVC 1.0 app just setup but it only shows the Index.aspx
I have Core Data setup in my app and need to fetch a bunch
I have facebook login setup in my android app. When the user clicks login
I have built a web setup project in VS2008 which installs my ASP.NET/Silverlight app

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.