Click here to Skip to main content
15,898,036 members
Home / Discussions / C#
   

C#

 
QuestionAlarm on Event in Event Calendar Pin
fangenius21-Feb-07 3:29
fangenius21-Feb-07 3:29 
QuestionC# childcontrol not editable in designtime. Pin
topcatalpha21-Feb-07 3:26
topcatalpha21-Feb-07 3:26 
AnswerRe: C# childcontrol not editable in designtime. Pin
Martin#21-Feb-07 3:42
Martin#21-Feb-07 3:42 
QuestionDifference between += and -= when defining events Pin
sharpiesharpie21-Feb-07 3:20
sharpiesharpie21-Feb-07 3:20 
AnswerRe: Difference between += and -= when defining events Pin
Martin#21-Feb-07 3:25
Martin#21-Feb-07 3:25 
GeneralRe: Difference between += and -= when defining events Pin
Martin#21-Feb-07 3:35
Martin#21-Feb-07 3:35 
AnswerRe: Difference between += and -= when defining events Pin
Luc Pattyn21-Feb-07 11:07
sitebuilderLuc Pattyn21-Feb-07 11:07 
QuestionSave Jpeg via Web Service Pin
Russell Jones21-Feb-07 3:02
Russell Jones21-Feb-07 3:02 
Hi,

I'm trying to save a jpeg onto a web server using a web service with a c# desktop app as the Web service consumer. I'm passing the image as a byte array

Here's the client side method:
public static byte[] GetBytes(Bitmap bmp)<br />
		{<br />
			if (bmp == null)<br />
				return new byte[0];<br />
<br />
			System.IO.MemoryStream stream = new System.IO.MemoryStream();<br />
			bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);<br />
			// maybe <br />
			// bmp.Dispose();<br />
						<br />
			return stream.GetBuffer();<br />
		}

And here's the Server side code to get a bitmap back:

      private static Bitmap GetImage(byte[] bytes)<br />
      {<br />
         if (bytes == null)<br />
            return null;<br />
<br />
         if (bytes.Length == 0)<br />
            return null;<br />
<br />
         System.IO.MemoryStream stream = new System.IO.MemoryStream(bytes);<br />
         Bitmap b = new Bitmap(stream);<br />
         stream.Close();<br />
         return (Bitmap)b.Clone();<br />
      }

This is the code that actually saves the image:


Bitmap bm = GetImage(imageData);<br />
GetImage(imageData).Save(@"c:\" + FileName,System.Drawing.Imaging.ImageFormat.Jpeg);


And i get this:

A generic error occurred in GDI+.\n at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)\n at System.Drawing.Image.Save(String filename, ImageFormat format)

Any ideas what i'm doing wrong? I assume i'm trying to save in the wrong format or something but i've tried all sorts of things to no avail

Thanks

Russell
AnswerRe: Save Jpeg via Web Service Pin
Russell Jones21-Feb-07 4:26
Russell Jones21-Feb-07 4:26 
AnswerRe: Save Jpeg via Web Service Pin
code-frog21-Feb-07 4:44
professionalcode-frog21-Feb-07 4:44 
Questiondifferences between asp and asp.net Pin
Rama krishna.M21-Feb-07 2:59
Rama krishna.M21-Feb-07 2:59 
AnswerRe: differences between asp and asp.net Pin
Russell Jones21-Feb-07 3:05
Russell Jones21-Feb-07 3:05 
GeneralRe: differences between asp and asp.net Pin
lost in transition 21-Feb-07 3:57
lost in transition 21-Feb-07 3:57 
AnswerRe: differences between asp and asp.net Pin
Guffa21-Feb-07 4:57
Guffa21-Feb-07 4:57 
QuestionSecuring SOAP communications with TLS-PSK Pin
AdrianFreemantle21-Feb-07 2:55
AdrianFreemantle21-Feb-07 2:55 
QuestionMDI problem Pin
Jan-Erik Romoeren21-Feb-07 2:49
Jan-Erik Romoeren21-Feb-07 2:49 
AnswerRe: MDI problem Pin
Martin#21-Feb-07 3:51
Martin#21-Feb-07 3:51 
GeneralRe: MDI problem Pin
Jan-Erik Romoeren22-Feb-07 21:59
Jan-Erik Romoeren22-Feb-07 21:59 
AnswerRe: MDI problem Pin
Bekjong21-Feb-07 4:42
Bekjong21-Feb-07 4:42 
GeneralRe: MDI problem Pin
Jan-Erik Romoeren22-Feb-07 22:10
Jan-Erik Romoeren22-Feb-07 22:10 
QuestionScroll With Code Pin
MHASSANF21-Feb-07 2:29
MHASSANF21-Feb-07 2:29 
AnswerRe: Scroll With Code Pin
K.P.Kannan21-Feb-07 20:44
K.P.Kannan21-Feb-07 20:44 
QuestionRe: Scroll With Code Pin
MHASSANF23-Feb-07 21:25
MHASSANF23-Feb-07 21:25 
QuestionAjax Calender (new) Control can not work properly with Dynamic updated panel Pin
jaganil21-Feb-07 2:15
jaganil21-Feb-07 2:15 
AnswerRe: Ajax Calender (new) Control can not work properly with Dynamic updated panel Pin
ednrgc21-Feb-07 2:55
ednrgc21-Feb-07 2:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.