ciao, ho questo codice
Codice PHP:
<%@ Page language="c#" Debug ="true" %>
<%@ 
Import namespace="System.IO" %>
<%@ 
Import namespace="System.Net" %>
<%@ 
Import namespace="System.Drawing" %>
<
script runat="server">
        private 
void ResizeAndSave(Stream imgStr,int Widthint Height,string FileName)
        {
            
//creo il bitmap dallo stream
            
System.Drawing.Image bmpStream=System.Drawing.Image.FromStream(imgStr);
            
//creo un nuovo bitmap ridimensionandolo
            
Bitmap img=new Bitmap(bmpStream,new Size(Width,Height));
            
//salvo l'immagine ridimensionata
            
img.Save(FileName,System.Drawing.Imaging.ImageFormat.Jpeg);
            
            
Response.Write("saved");
        }

        private 
void CaricaClick(object senderSystem.EventArgs e)
        {
            
Environment.CurrentDirectory=AppDomain.CurrentDomain.BaseDirectory;
            
//controllo che sia un jpg
            
if (file1.PostedFile.ContentType=="image/jpeg" || file1.PostedFile.ContentType=="image/pjpeg")
            {
                
//pass lo stream del file uplodato
                
ResizeAndSave(file1.PostedFile.InputStream,100,70,"img1.jpg");
                
//salvo così com'è
                
file1.PostedFile.SaveAs("img1g.jpg");
            }
        }

        private 
void PrelevaClick(object senderSystem.EventArgs e)
        {
            
Environment.CurrentDirectory=AppDomain.CurrentDomain.BaseDirectory;
            
WebClient wDown=new  WebClient();
            
//prelevo l'immagine dal web facendomi restituire un array di byte
            //inserisco l'array di byte nello stream di memoria così lo passiamo alla funzione
            
MemoryStream DataM=new MemoryStream(wDown.DownloadData(url.Text));
            
ResizeAndSave(DataM,100,70,"img2.jpg");
        }
</script>
<HTML>
    <HEAD>
        <title>Ridimensione immagini</title>
    </HEAD>
    <body>
        <form id="Form1" method="post" runat="server" enctype="multipart/form-data">
            


                Carica file <INPUT type="file" id="file1" runat="server">
                <asp:Button id="btnCarica" runat="server" Text="Carica" OnClick="CaricaClick"></asp:Button></P>
            

Carica url
                <asp:TextBox id="url" runat="server"></asp:TextBox>
                <asp:Button id="Preleva" runat="server" Text="Preleva" OnClick="PrelevaClick"></asp:Button></P>
            


            </P>
        </form>
    </body>
</HTML> 

mi restituisce questo errore sulla linea 13:


A generic error occurred in GDI+.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.

Source Error:

Line 11: Bitmap img=new Bitmap(bmpStream,new Size(Width,Height));
Line 12: //salvo l'immagine ridimensionata
Line 13: img.Save(FileName,System.Drawing.Imaging.ImageForm at.Jpeg);
Line 14:
Line 15: Response.Write("saved");

cosa potrebbe essere ?
grazie