Re: Argument exception Urgent
- From: Jon Skeet [C# MVP] <skeet@xxxxxxxxx>
- Date: Tue, 25 Oct 2005 07:29:03 +0100
Peter <Peter@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
> I have asp.net code using C# that will convert tif file into jpg and then it
> display them. The program works on my machine and Dev machine with Window XP
> professional. When I deploy the program on test machine (window 2003 server)
> I get error:
>
> Argument Exception Invalid parameter used"
>
> The code that causes the error is:
>
> byte[] imgbyte;
> MemoryStream memStream = new MemoryStream(imgByte.Length);
> memStream.Write(imgByte, 0 , imgByte.Length);
> System.Drawing.Image.FromStream(memStream);
Well, I'm sure that isn't the whole of the code which causes the error,
as that wouldn't compile.
However, you should really put the position of the stream back to 0
before passing it to Image.FromStream - you're asking it to read from a
stream which is already at the end at the moment.
--
Jon Skeet - <skeet@xxxxxxxxx>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
.
- Prev by Date: Re: Get Assembly Type Names Without Loading The Assembly
- Next by Date: Re: .config file - writing to it?
- Previous by thread: Re: RegExp: incrementing digit in replacement expressions
- Next by thread: Re: Exception related to machine.config
- Index(es):
Relevant Pages
|