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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:30:32+00:00 2026-05-22T15:30:32+00:00

Sometime we need to put / or ~/ as the suffix in order to

  • 0

Sometime we need to put / or ~/ as the suffix in order to make refer to the root

<script type="text/javascript" src="/scripts/jquery-1.5.1.min.js"></script>
<link href="~/Styles/MasterPage.css" rel="stylesheet" type="text/css" />

This is what i know from Phill

~/ is not valid unless you have a runat attribute on your control/element. ‘/’ by itself specifies to the browser to look from the root directory, so if you link to ‘/css/main.css’ from http://www.mysite.com/product/view.aspx it will look for the css file in http://www.mysite.com/css/main.css. When you use ‘~/’ with runat-server, it will work out the path to the directory at runtime, so in the same example with ‘~/css/main.css’ the rendered url will look like ‘../css/main.css’ because it needs to drop the directory back 1 before finding the directory ‘css’. (hope that makes sense) – Phill
How to include jquery in masterpage header without path problems?

but as i has tried, even i use / firefox still refer to ../../ instead of static path.
also, I don’t know it clearly how to use it correctly , which one use on which situation.

  • 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-22T15:30:33+00:00Added an answer on May 22, 2026 at 3:30 pm

    ~/ refers to virtual directory application root where as “/” refers to site roots eg if you have site that in http://www.example.com/ and which has http://www.example.com/foo where folder “foo” configured as virtual directory application in IIS a page in http://www.example.com/foo/foo.aspx will resolve ~/ as relative to virtual directory application root directory which is http://www.example.com/foo but “/” will still resolve to site root which is http://www.example.com/

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

Sidebar

Related Questions

I need some assistance with some javascript/jquery I have put in place. The function
I have a ListView which sometimes I need to put around 10000 items in.
Sometimes I need to quickly extract some arbitrary data from XML files to put
I need to deploy a few files that were checked in sometime ago (can't
I need to save a big file, sometime it takes a very long time
How come sometimes you need to put the method signature in the .h file
I put together a simple script that pulls the product name, category name and
I have PhoneGap app in Android using jQuery. Sometimes I need to upload some
We have been using asp.net mvc for development. Sometimes, we need to put some
I have a div on a page that I need to put content into.

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.