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

I am using Heroku for my production environment so I need to load the
I have a development environment set up in Windows using WAMP. The production environment
My production environment have a root, and my virtual directory will be at /brazil
Every time that I start up my grails application, using the production environment on
Our production environment runs 3 32-Bit Java 6 JVMs on each Windows 2003 server.
Our production environment is: IIS 6.0 .Net framework 4.0 ASP.Net 4.0 thread pool However,
In my production environment I have several Web applications installed in the same machine.
In our Production environment we have JBoss running in a clustered mode with 4+
The security policy at our client's production environment requires that we use separate connection
I'm currently setting up a new production environment for a Rails application which includes

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.