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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:55:27+00:00 2026-05-12T15:55:27+00:00

I am continually testing the new feature of ASP.NET MVC 2 Preview 2 called:

  • 0

I am continually testing the new feature of ASP.NET MVC 2 Preview 2 called: “Areas within one project”.
Currently I have a problem with linking to css and js files from within aspx code.

When the url points to an url without the id, everything works fine:

http://mysite.com/area/controller/action

The problem appears when the url contains the parameter:

http://mysite.com/admin/controller/action/id

then the page cannot find css and js files from /content and /scripts.

I think the problem is related to routing. I have standard routing rules set, eg:

        routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

        AreaRegistration.RegisterAllAreas();

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

and in the area’s route config:

        public override void RegisterArea(AreaRegistrationContext context)
    {
        context.MapRoute(
            "admin_default",
            "Admin/{controller}/{action}/{id}",
            new { controller = "Home", action = "Index", id = "" }
            );
    }

An example resource href in aspx file:

    <link href="../../Content/datatables.css" rel="stylesheet" type="text/css" />

Can anyone suggest a solution to resolve the problem of bad resource href?

  • 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-12T15:55:27+00:00Added an answer on May 12, 2026 at 3:55 pm

    When you are using URL routing, you don’t know how/many/path/parts there are going to be in your URL in advance. So you can’t use path-relative URLs at all: you don’t know how many ‘..’ segments you are going to need.

    Instead, use rooted URLs:

    <link href="/Content/datatables.css" rel="stylesheet" type="text/css" />
    

    If your application can be mounted on a non-root URL (eg. under one of your area​s, you must output that area name as part of the rooted URL. (Presumably this is obtained using AreaRegistrationContext.AreaName.)

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

Sidebar

Related Questions

We have very strange problem, one of our applications is continually querying server by
I have a program written in VB.Net with Visual Studio 2008. I have one
One of our developers is continually writing code and putting it into version control
I have a program that continually polls the database for change in value of
When working with my .Net 2.0 code base ReSharper continually recommends applying the latest
I have a lot of assignments where I have to continually update a Makefile
I have a plugin project I've been developing for a few years where the
I have a Java program that continually listens for messages of a certain format
I have a (PHP) script which runs on a new row in MySQL. However,
I am continually studying up on languages I have been using and learning, as

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.