473,287 Members | 1,689 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,287 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 10447
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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.