Ciao a tutti, premetto che questo non è il mio terreno(solitamente lavoro in php) quindi sono proprio asciutto di asp.net.
Ho dovuto fare uno script che mi ridimensiona le foto, il problema è che in locale funziona, appena l'ho messo online mi da l'errore 404..praticamente non mi trova la pagina!
metto lo script sperando che qualcuno mi sappia risolvere il problema
grazie
<%@ Page Language="C#" ContentType="text/html" ResponseEncoding="utf-8" Debug="true" %>
<% @Import Namespace="System.Drawing" %>
<% @Import Namespace="System" %>
<% @Import Namespace="System.Collections" %>
<% @Import Namespace="System.ComponentModel" %>
<% @Import Namespace="System.Data" %>
<% @Import Namespace="System.Web" %>
<% @Import Namespace="System.Web.SessionState" %>
<% @Import Namespace="System.Web.UI" %>
<% @Import Namespace="System.Web.UI.WebControls" %>
<% @Import Namespace="System.Web.UI.HtmlControls" %>
<% @Import Namespace="System.IO" %>
<% @Import Namespace="System.Text" %>
<% @Import Namespace="System.Data.SqlClient" %>
<% @Import Namespace="System.Configuration" %>
<script runat="server">
protected void Page_Load(object sender, EventArgs e) {

}
private void ResizeAndSave_big(Stream imgStr,int Width, string FileName) {
System.Drawing.Image bmpStream=System.Drawing.Image.FromStream(imgStr);
Double altezza;
Double larghezza;
larghezza = 0;
altezza=0;
if (Convert.ToDouble(bmpStream.Width)<Convert.ToDoubl e(bmpStream.Height)) {

altezza = Convert.ToDouble(Width);
larghezza = (Convert.ToDouble(bmpStream.Width) * Width ) / Convert.ToDouble(bmpStream.Height);
}
if (Convert.ToDouble(bmpStream.Width)>=Convert.ToDoub le(bmpStream.Height)) {
larghezza= Convert.ToDouble(Width);
altezza = (Convert.ToDouble(bmpStream.Height) * Width) / Convert.ToDouble(bmpStream.Width);
}
Bitmap img=new Bitmap(bmpStream,new Size(Convert.ToInt32(larghezza), Convert.ToInt32(altezza) ));
img.Save(FileName,System.Drawing.Imaging.ImageForm at.Jpeg);
}
private void ResizeAndSave_thumb(Stream imgStr,int Width, string FileName) {
System.Drawing.Image bmpStream=System.Drawing.Image.FromStream(imgStr);
Double altezza;
altezza = (Convert.ToDouble(bmpStream.Height) * Width) / Convert.ToDouble(bmpStream.Width);

//creo un nuovo bitmap ridimensionandolo
Bitmap img=new Bitmap(bmpStream,new Size(Width, Convert.ToInt32(altezza)));

//salvo l'immagine ridimensionata img.Save(FileName,System.Drawing.Imaging.ImageForm at.Jpeg);
}
private void CaricaClick(object sender, System.EventArgs e) {
//controllo che sia un jpg
if (file1.PostedFile.ContentType=="image/jpeg" || file1.PostedFile.ContentType=="image/pjpeg") {
String nomefile;
nomefile = Request.QueryString["id"] + ".jpg";

//pass lo stream del file uplodato
Environment.CurrentDirectory = AppDomain.CurrentDomain.BaseDirectory + "/public//big"; ResizeAndSave_big(file1.PostedFile.InputStream,Con vert.ToInt32(txtlarghezza.Value),nomefile.ToString ());
Environment.CurrentDirectory=AppDomain.CurrentDoma in.BaseDirectory + "/public//thumbs";
ResizeAndSave_thumb(file1.PostedFile.InputStream,1 57,nomefile.ToString());
Response.Redirect("carica_foto.aspx?msg=ok");
} }
</script>
<HTML>
<HEAD>
<title>Ridimensione immagini</title>
</HEAD>
<body style="background-color:#f0f0f0; font-family:Arial, Helvetica, sans-serif; font-size:12px">
<form id="Form1" method="post" runat="server" enctype="multipart/form-data">
<table width="427" border="0" cellspacing="1" cellpadding="2" style="background-color:#fff; border:1px solid #CCC; font-size:12px">
<tr>
<td width="150" align="right">Carica Immagine</td>
<td width="264"><input type="file" id="file1" runat="server"></td>
</tr>
<tr>
<td align="right">Larghezza foto grande</td>
<td><input type="text" id="txtlarghezza" value="300" runat="server">pixel</td>
</tr>
<tr>
<td></td>
<td>
<asp:Button ID="btnCarica" runat="server" Text="Carica" OnClick="CaricaClick"></asp:Button></td>
</tr>
<tr>
<td><%// if (Request.QueryString["id"] = "ok") { // MessageBox.Show("Foto inserita!"); //} %></td>
<td></td>
</tr>
</table>
</form>
</body>
</HTML>