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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:28:47+00:00 2026-05-15T22:28:47+00:00

I am using the latest version of MVCContrib and attempting to include a stylesheet

  • 0

I am using the latest version of MVCContrib and attempting to include a stylesheet via the following helper method:

<%=Html.Stylesheet(Links.Content.Site_css)%>

The path rendered is incorrectly calculated as:

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

The actual path should be: /Content/Site.css

Is this a bug?

The following methods work correctly:

METHOD 1: <%=Html.Stylesheet("~/Content/Site.css")%>

METHOD 2: <link type="text/css" rel="stylesheet" href="<%:Links.Content.Site_css %>" />

UPDATE 1:

Links.Content.Site_css represents a static field that is auto-generated using T4MVC

UPDATE 2:
Here is what the code generated by T4MVC looks like…

namespace Links {

    ...snipped for brevity...

    [GeneratedCode("T4MVC", "2.0"), DebuggerNonUserCode]
    public static class Content {
        private const string URLPATH = "~/Content";
        public static string Url() { return T4MVCHelpers.ProcessVirtualPath(URLPATH); }
        public static string Url(string fileName) { return T4MVCHelpers.ProcessVirtualPath(URLPATH + "/" + fileName); }

        public static readonly string Site_css = Url("Site.css");
}
  • 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-15T22:28:47+00:00Added an answer on May 15, 2026 at 10:28 pm

    Not a bug. This works as expected. Refer to Using MvcContrib ScriptInclude, Stylesheet, And T4MVC

    the output of the T4MVC Links are relative paths that have been resolved (meaning they no longer have the “~”). The MVC Contrib Helpers assume that if the URL passed it it doesn’t have the “~”, then it will prepend either “~/Scripts/” for scripts or “~/content/css/’” for styles.
    Seeing that I have moved my scripts, styles, and images under the “~/Content” folder, there are a couple of changes to the MVC Contrib Html Helpers that could make this work…
    Provide some sort of mechanism to define the paths prepended to the Scripts and Styles if there is no “~”
    Override the Html Helpers with another option to not prepend any path information
    Possibly search for the “/” instead of the “~” when determining if a path should be prepended to the URL

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

Sidebar

Related Questions

I am using the latest version of inno that does the following during setup:
I'm attempting to implement a PreInsertEvent listener using the latest version (which was at
Using the latest version of EasyMock, I have a method that I need to
Are the following actions possible using the latest version of the Android API?: Temporarily
Using the latest version of Resharper (4.5.x) with VS2008. Every now and then (pretty
I'm using XAMPP (latest version) on OS 10.6.2, that's bundled with PHP 5.3.0 I
Hello i am using the latest version of artoolkit, and succesfully compiled simplevrml, but
I am using the latest version of protobuf-net with VS2008 integration. I have created
I am using wordpress latest version. Currently my blog is set to custom permalink
I'm using the latest version of Gradle (milestone 9), and I'm trying to figure

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.