Subject: image directory asp.net
Posted By: sand133 Post Date: 8/21/2006 6:34:27 AM
I guys,

I am currently rewriting my asp application to ASP.net. The current file structure is  as follow

dir: A
dir: B
dir: C
dir: Images
dir: Style

Dir A, B and C being directories that hold asp pages.
my question is how do i do this in ASP.net and how can i reference images from the image directory into my new ASP.NET pages

thanks

Reply By: Imar Reply Date: 8/21/2006 1:10:06 PM
Just like you normally would. E.g. from the A folder:

<img src="../Images/MyImage.gif" />

or

<asp:Image ImageUrl="../Images/MyImage.gif" runat="server" />

In addition to that, .NET also supports the ~ syntax where the ~ points to the application's root. This works only with server side controls (e.g. <asp:Image /> and <img runat="server" />):

Again, from the A folder:

<img src="~/Images/MyImage.gif" runat="server" />

or

<asp:Image ImageUrl="~/Images/MyImage.gif" runat="server" />

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
Want to be my colleague? Then check out this post.

Go to topic 48636

Return to index page 198
Return to index page 197
Return to index page 196
Return to index page 195
Return to index page 194
Return to index page 193
Return to index page 192
Return to index page 191
Return to index page 190
Return to index page 189