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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T12:16:17+00:00 2026-05-20T12:16:17+00:00

My production environment is in a directory off the main url www.example.com/sample . Most

  • 0

My production environment is in a directory off the main url www.example.com/sample. Most of my URLs are resolving fine by using ~, so ~/default.aspx resolves to www.example.com/sample/default.aspx.

However, none of my javascript of css is loading correctly in production. I have the script src set to, for example, js/sample.js, and I have tried ~/js/sample.js and it does not resolve. I tried runat="server" in the <script> tag, but I got an error sometimes. I have:

<script runat="server" src="~/js/sample.js?<%=   MyCode.VersionInfo.JSTag %>" type="text/javascript"></script>

Here I am tagging a version code to the end of the filename to force reload during debugging, however, with runat=server it complains about this.

I’m sure this is a common issue, and there is a standard idiom for handling it, but I can’t seem to find it. Can someone help me? When and how does the ~ get expanded, and how do people handle this type of thing?

Most likely when the web site goes to full production, it will go in without the subdirectory, so I need to handle this systematically.

  • 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-20T12:16:18+00:00Added an answer on May 20, 2026 at 12:16 pm

    what you are looking for is:

    <script type="text/javascript" src="<%= this.ResolveUrl("~/js/sample.js?" + MyCode.VersionInfo.JSTag) %>"></script>
    

    more information here

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

Sidebar

Related Questions

Is using SQL Express in a production environment a reasonable choice? I looked at
My production environment involves a pair of IIS 6 web servers, one running legacy
I'm tasked with replicating a production environment to create many test/sit environments. One of
We have a problem affecting the production environment only. We have a VB6/ASP website
Has anyone out there used Postsharp AOP framework in a production environment? Are there
I want to make sure my local is matching the production environment closely and
I'm wondering about the downsides of each servers in respect to a production environment.
Grails makes it very easy to configure datasources for different environments (development, test, production)
I'm debugging a production application that has a rash of empty catch blocks sigh
When writing production-quality VC++ code, is the use of recursion acceptable? Why or why

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.