what is wrong with this line

  • Thread starter Thread starter Tommy Martin
  • Start date Start date
T

Tommy Martin

I am trying to use a bitmap in my asp.net page and I am running into a
problem because the name of the path has a space in it. Is this a limitation
of the function or am I just overlooking something?

If the filename has a space in the path i get an error "Invalid parameter".

Thanks in advance.

Tommy


Dim cPic As String = "d:\pics\picture.jpg" <---- works
Dim cPic As String = "d:\my pictures\picture.jpg" <---- does not work
Dim oPic As New Bitmap(cPic)
 
I didn't do a repro, but it sounds like a problem with the constructor for
the Bitmap class.
How about just doing this to get around it:

Dim oPic As New Bitmap(chr(34) & cPic & chr(34))

Jerry
 
Hi Tommy,

As far as I know till now, you can not use direct a bitmap in an asp.net
page.

HTML won't let you use a bitmap and an asp.net page is basicly HTML, so when
we go look for the error the endresult will probably be nothing.

Just something to warn you.

Cor
I am trying to use a bitmap in my asp.net page and I am running into a
problem because the name of the path has a space in it. Is this a limitation
of the function or am I just overlooking something?

If the filename has a space in the path i get an error "Invalid
parameter".
 
Tommy Martin said:
I am trying to use a bitmap in my asp.net page and I am running into
a problem because the name of the path has a space in it. Is this a
limitation of the function or am I just overlooking something?

If the filename has a space in the path i get an error "Invalid
parameter".

Thanks in advance.

Tommy


Dim cPic As String = "d:\pics\picture.jpg" <---- works
Dim cPic As String = "d:\my pictures\picture.jpg" <---- does not
work
Dim oPic As New Bitmap(cPic)


"does not work" means? Compile error? Runtime exception? Which one?
Unexpected behavior?
 
I am loading the bitmap and overlaying text on it then sending the
"image/jpeg" data back to the response stream. It works fine if there is no
space in the path.

Tommy
 
I will give this a try.

Jerry Ham said:
I didn't do a repro, but it sounds like a problem with the constructor for
the Bitmap class.
How about just doing this to get around it:

Dim oPic As New Bitmap(chr(34) & cPic & chr(34))

Jerry
 
Tommy Martin said:
Runtime error "Invalid parameter".

Unfortunately there is no list of possible exceptions in the docs to the
ctor. Did you also try it with other files in the _same_ directory? Can you
view the file from the explorer?
 
Tommy Martin said:
If the filename has a space in the path i get an error "Invalid parameter".

Dim cPic As String = "d:\pics\picture.jpg" <---- works
Dim cPic As String = "d:\my pictures\picture.jpg" <---- does not work
Dim oPic As New Bitmap(cPic)

There is nothing "wrong" with the code and it works fine with a space in the
path. And if the file didn't exist or the path was mistyped it wouldn't
yield and invalid parameter error.

So... I have to guess this isn't the exact code you have or something just
got all messed up. Delete the lines, save the project, restart Visual
Studio, retype the lines and try again. If it persists, start a dummy
project and just put the two lines into a test procedure... you will see
that it works.

Tom
 
Tommy Martin said:
If the filename has a space in the path i get an error "Invalid
parameter".

Hold on... is it "Invalid parameter used" ?

Check that the file in your "my pictures" folder really is a jpeg... rename
a text file to ".jpg" (to test it) for instance and you will get that error.
 
Back
Top