Click here to Skip to main content
15,887,966 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am having problem related to asp.net. Whenever i tried to set url of an image as a background it doesn't display in browser after debugging.

HTML
<div align="center" style="background-color: transparent; background-image: removed(App-Data/Images/blue.jpg);">

HTML
<body background="C:\Documents and Settings\sse\My Documents\Visual Studio 2008\Projects\WebApplication2\WebApplication2\App_Data\images\background.png">
Posted
Updated 20-Jun-12 22:58pm
v6
Comments
ssd_coolguy 21-Jun-12 4:38am    
hey ..let us know what you tried..
mistiarora 21-Jun-12 4:43am    
First i created a images floder in App_Data and paste image in it.
but when i gave url in <body background="App_Data/Images/blue.jpg>
it doesn't show after debugging on browser.
Vani Kulkarni 21-Jun-12 4:48am    
Your code should work. Not sure why it is not. Try this:
<body style="background-image:url(bgimage.jpg)">

mistiarora 21-Jun-12 4:53am    
in design view i can see the image but in browser its not appear.
Vani Kulkarni 21-Jun-12 4:59am    
Try this: <body background="~/App_Data/Images/blue.jpg>

I think you should move your image to outside of App_Data because .net framework restricts web servers to directly access data from application folders(one of them is App_Data).
For more details read this article: http://msdn.microsoft.com/en-us/library/ex526337.aspx[^]

Specifically line:"The content of application folders, except for the App_Themes folder, is not served in response to Web requests, but it can be accessed from application code."
 
Share this answer
 
v2
hi,

Hey create one folder image and paste all the image files which you are using in your application.
Then use that image in your application using following tag in your aspx page

HTML
<img src="images/bg0001.gif" height="32" hspace="0" vspace="0" align="left" style="width: 1050px"></img>
 
Share this answer
 
The absolute path of the image you are providing will not work.

The image should be first added to the website and then assign the path of the image to the ImageUrl property.
 
Share this answer
 
mistake was location of the folder named images.
i create that folder outside, not in App_Data and after did this its working on the browser.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900