im making a generic website for my class and we have to post a graphic for this website from this cd that came with the book. Problem is, i can't get the Image URL to post my graphic. I tried using the image button and the image thing in the html section of the toolbox but either will work. What can i do?

--Sincerely,
running out of ideas

Dani AI

Generated

A quick practical checklist to get a picture showing in an ASP.NET (VB.NET) web page. The Image control only serves files that live inside the web site—so the image file must be added to the site first. Common ways to add it are: use Visual Web Developer’s "Add Existing Item..." to import the file, or copy the file into the project’s physical folder on disk and then use Solution Explorer’s Refresh / Show All Files and include it in the project. For Web Application projects the file must be included in the project; for Web Site projects it just needs to be in the folder structure.

Example markup and a server-side assignment:

<asp:Image ID="Image1" runat="server" ImageUrl="~/images/bookpic.jpg" />

' In code-behind (VB)
Image1.ImageUrl = ResolveUrl("~/images/bookpic.jpg")

Troubleshooting checklist (most common blockers):

  • Permissions: writing into the system web root (inetpub) may be blocked—run the IDE as Administrator or work from a writable project folder in Documents.
  • Don’t reference files directly on the CD; copy them into the site first.
  • Path syntax: leading / is site-root, ./ is page-relative, and ~ is application-root (the ~ only resolves for server controls or when using ResolveUrl). HTML <img src="..."> won’t handle ~ unless wrapped with ResolveUrl.
  • Filenames: remove spaces, odd characters or very long names.
  • For Web Application projects set the file’s Build Action to Content so it’s deployed and visible.

Tie-in to the thread: is right to work with localhost; the most likely causes of ’s problem are either the image wasn’t actually copied into the site folder or OS permissions prevented the copy. Verifying the image URL directly in a browser () will show whether the file is reachable.

Recommended Answers

All 4 Replies

Maybe i wasn't clear in what I was trying to do. I am trying to create a program using vb.NET Visual Web Developer. in the instructions, it said the following: You can add graphics, to a web page using the image control. the concept is similar to the PictureBox control on WindowsForms. but the graphic file is connected differently due to the nature of web applications. Each Image control has an Image Url property that specifies the location of the graphic file. To place an image on a web page, you should first copy the graphic into the website folder. if the porject is open in the IDE when you add the graphic files, click the refresh button at the top of the solution foldr to make the fiels show up.

you can add an image contorl to a cell in a table or directly on a web page. In the ImageUrl property button(...) to open the Select Image dialog box. If you have added the graphic to the project folder and either clidked teh Solution Explored Refresh button or reopened the project, the graphic file will appear in the contents pane.

My question is concernin hwo do i copy the graphic into the website folder...i'm getting the graphic from the book's cd--but i'm having all types of problems getting it to copy..Can anyone provide any solution?

i'm getting the graphic from the book's cd--but i'm having all types of problems getting it to copy

What are all types of problems?

You're working with localhost? Your localhost resides on "D:\Inetpub\wwwroot" (this is my computer so your could be "C:\..." or something else). You've created a web-project "local". That resides on "D:\Inetpub\wwwroot\local". Open explorer, go to that folder and make a new folder, let's say "img". Now open your CD, locate images from there and copy them to "D:\Inetpub\wwwroot\local\img"-folder.

Start VWD and add an image to your web page. From Properties, click "Source" and "..."-button to locate image. Your project folder ("D:\...\local" in mine) should open, click "img" folder, select the image and press Ok-button. It should now appear on your page.

You mentioned ImageUrl-property, that's the same as Source-property in the above. I may have an older version of VWD.

yes im working with the localhost

Ok, let me now if its working now.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.