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

The Archive Base Latest Questions

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

Iam new to ASP.NET and poking around my first ASP Web Application projects in

  • 0

Iam new to ASP.NET and poking around my first ASP Web Application projects in .NET 4.0
I have problem, which I can’t solve, and google searches does not bring any joy.

So I would kindly ask for help and/or explanation of following problem:

Assume that I have set up following project structure:

\default.aspx
\[gfx] (dir)
   \[images]
     \picture.jpg
   \[css]
     \stylesheet.css
   \[js]
     \jquery.js
\[backend]
   \main.aspx

So, in default.aspx I can link to image or css like that:

     < img src="/gfx/images/picture.jpg">
     < link rel="stylesheet" type="text/css" href="/gfx/css/stylesheet.css"/>

It works, but Iam afraid that this linking technique is not the “correct” one. Yes – it works and it links, but as I was PHP developer I was always linking to the full path of resource, for ex:
< img src=”gfx/images/picture.jpg” />
Which was translated to
< img src=”http://www.mysite.com/gfx/images/picture.jpg&#8221; />

Is there a way to achieve similar result in ASP.NET without loosing the design preview in visual studio ? It my linking technique is common one or is there another way ?

Best regards

  • 1 1 Answer
  • 3 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-20T09:43:15+00:00Added an answer on May 20, 2026 at 9:43 am

    Mostly ~ operator is used, the asp.net automatically maps it to the root of your application.

    <head runat="server">
    <img src="~/gfx/images/picture.jpg">
    <link rel="stylesheet" type="text/css" href="~/gfx/css/stylesheet.css"/>
    </head>
    

    you can also use application root path in variable and can use. For Example

    <head>
    <img src="<%=SomeClass.SITEURL%>/gfx/images/picture.jpg">
    <link rel="stylesheet" type="text/css" href="~/gfx/css/stylesheet.css"/>
    </head>
    

    The use of later technique has a few advantages, as it is rendered as absolute path (little bit fast)
    and configurable in a sense if you want to place static content from different server.

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

Sidebar

Related Questions

I am new to ASP.NET and am trying to convert a web application from
I am new in asp.net,I have to luanch our application use asp.net,and I use
I am new to asp.net and failed to publish my web application on local
I am new ASP.NET and I have never used a GridView or DataGrid, but
I am new to ASP.NET MVC, particularly ajax operations. I have a form with
I am new to ASP.net MVC architecture. I have read in some articles that
I am new to ASP.NET MVC 3 and I want to have username/id as
I am new to ASP.NET Development and can't decide between developing with Webforms or
iam using Asp.Net 2010 and MVC3 framework..I am new to this. When user registers
I am new to ASP.NET MVC Forms Authentication and have just started to create

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.