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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T06:36:27+00:00 2026-06-05T06:36:27+00:00

I am building an asp.net website and wish to create a user control that

  • 0

I am building an asp.net website and wish to create a user control that includes a reference to a graphic file in a different directory. Specifically my directory structure looks like:

c:\mywebsite\
c:\mywebsite\images\
c:\mywebsite\usercontrols

The user control will be used in c:\mywebsite\default.aspx

The image is c:\mywebsite\images\logo.jpg
The user control is c:\mywebsite\usercontrols\mycontrol.ascx

If in my ascx file I have:

<img src="../images/logo.jpg" />

Then this renders just fine in the Visual Studio 2010 design view, but not at run time since at run time the control is included in \default.aspx and the path relative to \default.aspx is different from the relative path from \usercontrols\mycontrol.ascx.

How should I reference the graphic from the ascx file so that it will render properly both in design preview as well as at runtime? Also I would like it to render properly in design preview for default.aspx where it is used.

  • 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-06-05T06:36:29+00:00Added an answer on June 5, 2026 at 6:36 am

    You can use <asp:Image>... control and use the image path as relative path from the web root

    <asp:Image ImageUrl='~/Images/logo.jpg" runat="server" /> 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am building an ASP.NET website that allows users to create and take tests.
I am building an ASP.NET website which will collect data from a user and
I'm building ASP.NET MVC2 website that lets users store and analyze data about goods
i m building website in asp.net when i run my pages i expect that
I'm building an ASP.NET MVC3 website. I have some javascript in my .cshtml file:
I am building an asp.net mvc website, after the user login he can access
I'm building a website in ASP.NET that allows creating new modules based on a
I'm building a website with ASP.NET MVC3. When a user signs in, I pull
I'm building my first ASP.NET MVC website, and I'm trying to figure out how
I am looking at building the login/registration part of a website (ASP.NET) and would

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.