473,386 Members | 1,790 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Image.ImageUrl

Hallo.,

i just encounterd a strange thing which i cannot resolve.

I am saving a bitmap created in memory to the asp temp folder (asp.net 2.0)
this works fine, and i donīt want to create an extra folder in my
application, so i donīt need my people giving that folder the asp
permissions.

Ok, my JPG is in the temp folder.
after saving it, i want to display it in a image control, at a later time i
need it for a report generation

my problem is that the path name contains whitespaces, which i found out the
imageurl does not like at all.
example
this.image.ImageUrl = @"C:\TestFolder/image.jpg";

this.image.ImageUrl = @"C:\Test Folder/image.jpg";

The 1st statement would display the image, the second not....of course the 2
folders exist with the image in them.

Are there any solutions for that?

Thanks

Thomas

May 12 '06 #1
3 10459
Spaces need to be encoded. For this you could use Server.URLEncode.
Be aware though that you need to use a URL to the image, not a local path
like you showed in your example. If you use a local path it will work when
tested on the local server but it will not work from any other client
machine.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Thomas Satzinger" <th****@tsatzinger.de> wrote in message
news:e4**********@online.de...
Hallo.,

i just encounterd a strange thing which i cannot resolve.

I am saving a bitmap created in memory to the asp temp folder (asp.net
2.0)
this works fine, and i donīt want to create an extra folder in my
application, so i donīt need my people giving that folder the asp
permissions.

Ok, my JPG is in the temp folder.
after saving it, i want to display it in a image control, at a later time
i need it for a report generation

my problem is that the path name contains whitespaces, which i found out
the imageurl does not like at all.
example
this.image.ImageUrl = @"C:\TestFolder/image.jpg";

this.image.ImageUrl = @"C:\Test Folder/image.jpg";

The 1st statement would display the image, the second not....of course the
2 folders exist with the image in them.

Are there any solutions for that?

Thanks

Thomas

May 12 '06 #2
Hi,

thanks for the tip, but it does not work..

i tried this.image.ImageUrl = Server.UrlEncode(@"C:\Test Folder/image.jpg");

and i still do not get the image displayed...

The path shown here is just a sample...

Thomas
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> schrieb im Newsbeitrag
news:uX*************@TK2MSFTNGP04.phx.gbl...
Spaces need to be encoded. For this you could use Server.URLEncode.
Be aware though that you need to use a URL to the image, not a local path
like you showed in your example. If you use a local path it will work
when tested on the local server but it will not work from any other client
machine.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Thomas Satzinger" <th****@tsatzinger.de> wrote in message
news:e4**********@online.de...
Hallo.,

i just encounterd a strange thing which i cannot resolve.

I am saving a bitmap created in memory to the asp temp folder (asp.net
2.0)
this works fine, and i donīt want to create an extra folder in my
application, so i donīt need my people giving that folder the asp
permissions.

Ok, my JPG is in the temp folder.
after saving it, i want to display it in a image control, at a later time
i need it for a report generation

my problem is that the path name contains whitespaces, which i found out
the imageurl does not like at all.
example
this.image.ImageUrl = @"C:\TestFolder/image.jpg";

this.image.ImageUrl = @"C:\Test Folder/image.jpg";

The 1st statement would display the image, the second not....of course
the 2 folders exist with the image in them.

Are there any solutions for that?

Thanks

Thomas


May 13 '06 #3
I suggest you to user Server.MapPath to have site relative path, so if
your image is in /pictures of your site you use this:

this.image.ImageUrl = Server.UrlEncode(Server.MapPath(pictures/image.jpg));

It your images are stored out of your site path, you may be give a look
to http handlers...

Thomas Satzinger wrote:
Hi,

thanks for the tip, but it does not work..

i tried this.image.ImageUrl = Server.UrlEncode(@"C:\Test Folder/image.jpg");

and i still do not get the image displayed...

The path shown here is just a sample...

Thomas
"Steve C. Orr [MVP, MCSD]" <St***@Orr.net> schrieb im Newsbeitrag
news:uX*************@TK2MSFTNGP04.phx.gbl...
Spaces need to be encoded. For this you could use Server.URLEncode.
Be aware though that you need to use a URL to the image, not a local path
like you showed in your example. If you use a local path it will work
when tested on the local server but it will not work from any other client
machine.

--
I hope this helps,
Steve C. Orr, MCSD, MVP
http://SteveOrr.net
"Thomas Satzinger" <th****@tsatzinger.de> wrote in message
news:e4**********@online.de...
Hallo.,

i just encounterd a strange thing which i cannot resolve.

I am saving a bitmap created in memory to the asp temp folder (asp.net
2.0)
this works fine, and i donīt want to create an extra folder in my
application, so i donīt need my people giving that folder the asp
permissions.

Ok, my JPG is in the temp folder.
after saving it, i want to display it in a image control, at a later time
i need it for a report generation

my problem is that the path name contains whitespaces, which i found out
the imageurl does not like at all.
example
this.image.ImageUrl = @"C:\TestFolder/image.jpg";

this.image.ImageUrl = @"C:\Test Folder/image.jpg";

The 1st statement would display the image, the second not....of course
the 2 folders exist with the image in them.

Are there any solutions for that?

Thanks

Thomas


May 13 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Benji | last post by:
I am trying to open an image from a binary field in SQL Server. I have got a far as making an object which holds the image. I have done this using an example off the site of microsoft. Now I am...
9
by: Leigh Kendall | last post by:
I can't find any issue in the MS KB, but I'm experiencing the following problem which seems to be specific to IE5, and NOT any other version of IE 5.5+ or NN 6+. Issue: I'm using an asp.net...
2
by: Vitalii | last post by:
Hi I am using Image control with DataList control but have a problem. Here is the code I am using <asp:Image ImageURL='<%# DataBinder.Eval(Container.DataItem, "imagefilename" ) %>'...
2
by: Chris Dunaway | last post by:
I was looking over some asp.net code and saw this asp:Image control: <asp:Image ImageUrl="~/images/logo.gif" runat="server" ID="Image1"/> What does the tilde (~) mean in the ImageUrl...
2
by: SQL_Klovn | last post by:
Hi! I have been struggeling for quite some time now with a stupid problem which drives me crazy. I have Datagrid, where I load some images from a SQL2000 database. This works fine, but I am not...
0
by: csgraham74 | last post by:
Hi there, i have creted a datagrid control to display images using the following code. <asp:DataGrid id="dg_Properties" runat="server" HorizontalAlign="Center" Width="450px"...
2
by: Jokerr | last post by:
I have a problem with the Image object and ImageURL. I've looked over some forums however I've gotten nowhere but frustrated fast. I've verified all the data and it's correct. No special...
3
by: GaryDean | last post by:
The only way to get a bitmap object into an image control is to set the ImageURL to a web page that writes the object to the Output stream. This also worked just fine for me when I put the Image...
5
by: Jeff | last post by:
hi asp.net 2.0 I get this compile error: 'Image' does not contain a definition for 'ImageUrl' Image image = (Image)e.Item.FindControl("img"); image.ImageUrl = "~/image.png";
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.