pietro scusa se disturbo ancora ma ho uno strano problema
le due variabili vengono recuperate e stampate a video ma non riesco ad usarle in altro modo. cioè quei due numeri devono far parte del nome di un file che viene creato da questa pagina aspx, appunto. Posto tutta la pagina così ci capisci/capite meglio. (è' un esempio trovato sul web che serve per fare l'upload ed il resize delle immagini.) Ho evidenziato in rosso le due righe dove avviene la concatenazione di costanti e variabili ma non vengono assunti i due valori in questione. L'output nella cartella delle immagini dovrebbe essere "Ad_Id+numero annuncio+numero foto.ext", per la foto e "Ad_Id+numero annuncio+numero foto+_thumb.ext", per la miniatura creata.

<%@ Page Trace="False" Language="vb" aspcompat="false" debug="true" validateRequest="false"%>
<%@ Import Namespace=System.Drawing %>
<%@ Import Namespace=System.Drawing.Imaging %>
<%@ Import Namespace=System %>
<%@ Import Namespace=System.Web %>
<SCRIPT LANGUAGE="VBScript" runat="server">

const Lx = 200
const Ly = 240
const upload_dir = "/ad_images/"
const upload_original = "Ad_"
const upload_thumb = "_thumb"
const upload_max_size = 1500
dim fileExt
dim newWidth, newHeight as integer
dim l2
dim fileFld as HTTPPostedFile
Dim originalimg As System.Drawing.Image
dim msg
dim upload_ok as boolean
dim ad_id
dim picnumber
</script>
<script language="vbscript" runat="server">

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim ad_id As String = Me.Request.QueryString("ad_id")
Dim picnumber As String = Me.Request.QueryString("picnumber")

If ad_id IsNot Nothing Then
Me.Label1.Text = "ad_id = " & ad_id
End If

If picnumber IsNot Nothing Then
Me.Label2.Text = "picnumber = " & picnumber
End If

End Sub
</script>
<%

randomize()
upload_ok = false
if lcase(Request.ServerVariables("REQUEST_METHOD"))=" post" then
fileFld = request.files(0) ' get the first file uploaded from the form (note:- you can use this to itterate through more than one image)
if fileFld.ContentLength > upload_max_size * 1024 then
msg = "Attenzione, l'immagine deve essere max " & upload_max_size & "Mb"
else
try
originalImg = System.Drawing.Image.FromStream(fileFld.InputStrea m)
If (originalImg.Width/Lx) > (originalImg.Width/Ly) Then
L2 = originalImg.Width
newWidth = Lx
newHeight = originalImg.Height * (Lx / L2)
if newHeight > Ly then
newWidth = newWidth * (Ly / newHeight)
newHeight = Ly
end if
Else
L2 = originalImg.Height
newHeight = Ly
newWidth = originalImg.Width * (Ly / L2)
if newWidth > Lx then
newHeight = newHeight * (Lx / newWidth)
newWidth = Lx
end if
End If

Dim thumb As New Bitmap(newWidth, newHeight)

Dim gr_dest As Graphics = Graphics.FromImage(thumb)

dim sb = new SolidBrush(System.Drawing.Color.White)
gr_dest.FillRectangle(sb, 0, 0, thumb.Width, thumb.Height)

gr_dest.DrawImage(originalImg, 0, 0, thumb.Width, thumb.Height)

try
fileExt = System.IO.Path.GetExtension(fileFld.FileName).ToLo wer()
originalImg.save(Server.MapPath(upload_dir & upload_original & ad_id & "_" & picnumber & fileExt), originalImg.rawformat)
thumb.save(Server.MapPath(upload_dir & upload_original & ad_id & "_" & picnumber & upload_thumb & fileExt), originalImg.rawformat)
msg = "Uploaded " & fileFld.FileName & " to " & Server.MapPath(upload_dir & upload_original & fileExt)
upload_ok = true
catch
msg = "Sorry, there was a problem saving the image."
end try
' Housekeeping for the generated thumbnail
if not thumb is nothing then
thumb.Dispose()
thumb = nothing
end if
catch
msg = "Si è verificato un Errore. L'immagine non è stata elaborata."
end try
end if

' House Keeping !
if not originalImg is nothing then
originalImg.Dispose()
originalImg = nothing
end if

end if
%>
<html>
<head>
<title>ASP.NET File Upload and Resize Sample</title>
<META NAME="Description" CONTENT="ASP.NET File Upload and Resize Sample (Hybrid VB.NET)">
<META NAME="Keywords" CONTENT="ASP.NET, ASP, NET, VB, VBScript, Image, Upload, Resize, Thumbnail, Constrain, Filesize, File, Size, Free">
<META NAME="Copyright" CONTENT="Rufan-Redi Pty Ltd 2005">
<META NAME="Author" CONTENT="System developed by Jeremy at http://www.Rufan-Redi.com">
</head>
<body>



Hybrid ASP.NET File Upload and Resize Sample (VB.NET)

Upload and resize a GIP/JPG/PNG images, ensuring filesizes are optimum.</p>

<form id="form1" enctype="multipart/form-data" method="post" runat="server">
<table>
<tr><td>Select the file to upload:</td><td><input type="file" name="upload_file"></td></tr>
<tr><td colspan=2>Max upload size <%=upload_max_size%>Kb, gif/jpg/png only</td></tr>
<tr><td colspan=2><input type="submit" value="Upload"></td></tr>
<tr><td><asp:Label ID="Label1" runat="server" Text="" EnableViewState="false"></asp:Label>


<asp:Label ID="Label2" runat="server" Text="" EnableViewState="false"></asp:Label>
</td></tr>
</table>
</form>

<%
if upload_ok then
%>
<table>
<tr>
<td valign=top>[img]<%=upload_dir & upload_original & ad_id & [/img]"></td>
<td valign=top>[img]<%=upload_dir & upload_original & ad_id & [/img]"></td>
</tr>
</table>
<%
else
response.write(msg)
end if
%>
</body>
</html>