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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:07:35+00:00 2026-05-15T12:07:35+00:00

Visual Studio 2010 has a new feature that is just way cool. You can

  • 0

Visual Studio 2010 has a new feature that is just way cool. You can now add transformation files that will change the web.config file based on the configuration you are compiling. The upshot of which is that you can change the web.config file for your various environments (eg: dev, staging, production, etc).

That’s all fine and dandy for the web.config file but what about other pages that may need such tender care. Our master page, for example, points to different locations for it’s CSS file in different environments (Yes, I know, it wasn’t my idea and I can’t change it). Is there a cool and/or elegant way to make the change?

I have tried to using

  <appSettings>
    <add key="pathPrefix" value="/OAFA/"  xdt:Transform="Replace" xdt:Locator="Match(key)"/>
   </appSettings>

and then add the following in the master page. PathPrefix is a simple property that justs queries the value in the web config.

    <script src="<%= PathPrefix %>scripts/jquery-1.3.2.js" type="text/javascript"></script>

This works great for the scripts but sucks rocks for this….

    <link rel="Stylesheet" href="<%= PathPrefix %>css/main.css" />

In this case it just encodes the “<%=” and “%>” which is far less than ideal. Any thoughts?

  • 1 1 Answer
  • 1 View
  • 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-15T12:07:36+00:00Added an answer on May 15, 2026 at 12:07 pm

    Add an ID and a runat=”server” attribute to your link, like this:

    <link id="StylesheetLink" runat="server"
          rel="stylesheet" href="stylesheet1.css" type="text/css" />
    

    And then you can change the stylesheet’s source programmatically in your codebehind like this:

    StylesheetLink.Attributes["href"] = "stylesheet2.css";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Visual Studio 2010, when you say new Item, you can see Asp.NET Handler
I know Visual Studio 2010 has a new Code Analysis tool built in ,
I have virtual machine that has windows 7 + visual studio 2010 setup, and
The implementation of std::vector that ships with Visual Studio 2010 and earlier versions has
I am developing a solution in Visual Studio 2010 that has a WCF RESTful
I know Visual Studio 2010's standard library has been rewritten to support rvalue references,
Has anyone migrated a VB6 project to .Net with Visual Studio 2010? I have
Visual Studio 2010 RC -> Silverlight Application We have a library of images that
In Visual Studio 2010 Beta 2 I created a new navigation Silverlight application. Without
A coworker just installed Visual-Studio-2010 Premium from MSDN. The install acted like it worked

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.