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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T19:07:15+00:00 2026-06-01T19:07:15+00:00

My css file is in _layouts/MyProject/css/styles.css and I need to register it from code

  • 0

My css file is in _layouts/MyProject/css/styles.css and I need to register it from code behind. For this I should use CssRegistration.Register method:

CssRegistration.Register("MyProject/css/styles.css");

But you will get this exception:

Cannot make a cache safe URL for “1033/styles/MyProject/css/styles.css”, file not found. Please verify that the file exists under the layouts directory.

because SharePoint expect the css file in language specific folder e.g. for English 1033/styles.

Seems there is no parameter to turn this behavior off!

On the other hand very similar task, registration of the javascript file, supports such requirement, see the third parameter localizable:

ScriptLink.Register(Page, "MyProject/js/script.js", false);

Why the 2 classes for logically the same thing has so different interface? Is there any way how to register css out of the language specific folder? Or the only way is to distribute the same css file to those LCID folders?

  • 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-06-01T19:07:17+00:00Added an answer on June 1, 2026 at 7:07 pm

    You could instead create a new CssRegistration control and add it to the page. Then include the “/_layouts/” folder in the path

    CssRegistration cssRegistration = new CssRegistration
    {
      After = "corev4.css",
      Name = "/_layouts/MyProject/css/styles.css"
    };
    Controls.Add(cssRegistration);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making a CSS file for an XML document. I need to insert
We include the CSS file via standard HTML STYLE tag. Then we need the
I have a HTML/CSS File laid out with a bunch of areas that need
When I call image_url('path/to/image.png') in my css.scss file, I get this error: ActionView::Template::Error (Unrecognized
I'm trying to add a css file in my zend application layout.php the problem
My CSS file is acutally a PHP file which is served with content-type text/css
I have a CSS file, which contain the style information of my web. Some
In my main CSS file, I have my a:link selector set to display links
I build a css file using PHP which allows me to easily customize the
1) If inside CSS file we specify the following style: td { text-align:center; }

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.