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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:58:14+00:00 2026-05-20T23:58:14+00:00

If I have a url like /something/something/ and my site is http://mysite.com and I

  • 0

If I have a url like "/something/something/" and my site is http://mysite.com and I want to link to that something url, is there a method like Url.Content(); which will discover the virtual directory of the site in IIS and map appropriately to a url path?

I tried Url.GenerateContentUrl(), Url.Action(), Url.Content(), Url.RouteUrl()

  • 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-20T23:58:15+00:00Added an answer on May 20, 2026 at 11:58 pm

    is there a method like Url.Content();

    Why like when there is Url.Content?

    var url = Url.Content("~/something/something");
    

    which will take care of the virtual directory name and if your side is deployed at the root http://example.com it will return /something/something and if you have a virtual directory http://example.com/applicationname it will return /applicationname/something/something.

    So everytime you need to link a static resource you should always use Url.Content. For example:

    <img src="<%= Url.Content("~/images/foo.png") %>" alt="" />
    

    will always correctly resolve the image url no matter where your site is deployed to.

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

Sidebar

Related Questions

I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
I have URL like: http://example.com#something , how do I remove #something , without causing
We have an url like http://site.s3.amazonaws.com/images/some image @name.jpg inside $string What I'm trying to
I have an URL like this: http://site.com/images/961b7d0e50f0462a8828d31bf0874a71/lightbox I need to string.format replace the GUID
I have this link: http://mysite.com/subdirectory/something/stuff/index.php What regex would I be able to use that
If I have a jQuery POST call that looks something like: $.post(url : myserver/1,
I have a url like www.example.com/mypage.php?id=324 That number 324 is auto incremented (meaning that
Currently, I have 20+ URLs on my site in this format http://www.example.net/content/index/mission I want
Say I have the following site: http://example.com/site that is the same of http://site.example.com I
I have a url, something like this localhost:8080/foo.action?param1=7&param2=8&param3=6 When this is the Url (as

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.