Pagina 1 di 3 1 2 3 ultimoultimo
Visualizzazione dei risultati da 1 a 10 su 29
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    91

    Problema Versione Asp.net

    Salve,

    Ho uno script di ridimensionamento dell'immagini sviluppato in ASP.NET...
    ...ma non funziona.

    Ho provato a fare una paginetta aspx semplice e non funziona neanche quella.

    Mi era venuto il dubbio allora che sul server non fosse attivato l'ASP.NET, invece mi hanno detto che sul server era attivato "DOT.NET versione 1.1.4322".

    Puoi essere che la versione è troppo vecchia? E per questo non mi va nessuna pagina aspx?

    Qualcuno può aiutarmi?

    Grazie infinite, Kuilsera

  2. #2

    Re: Problema Versione Asp.net

    Originariamente inviato da Kuilsera
    Salve,

    Ho uno script di ridimensionamento dell'immagini sviluppato in ASP.NET...
    ...ma non funziona.

    Ho provato a fare una paginetta aspx semplice e non funziona neanche quella.

    Mi era venuto il dubbio allora che sul server non fosse attivato l'ASP.NET, invece mi hanno detto che sul server era attivato "DOT.NET versione 1.1.4322".

    Puoi essere che la versione è troppo vecchia? E per questo non mi va nessuna pagina aspx?

    Qualcuno può aiutarmi?

    Grazie infinite, Kuilsera
    Sarebbe???
    Se non posti almeno una paginetta di esempio sarà difficile aiutarti
    Se ti restituisce un errore posta almeno quello.
    Se l'applicazione è sviluppata ed utilizza funzioni del .net 2.0 non funzionerà,
    come giustamente pensavi, su piattaforma .Net 1.1.

    Richard B. Riddick : "Non avrete mica paura del buio?"

    Scusatemi ma sono mesi che non pago piu' la bolletta della luce....

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    91
    Una delle pagina aspx è la seguente:

    test.aspx
    ------------------------------------
    <%@ Page Language="C#" LCID=1040 Debug="true" Trace="false" %>
    <%@ Import Namespace="System" %>
    <%@ Import Namespace="System.IO" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Drawing" %>
    <%@ Import Namespace="System.Drawing.Imaging" %>
    <%@ Import Namespace="System.Drawing.Drawing2D" %>
    <%@ Import Namespace="System.Globalization" %>
    <%@ Import Namespace="System.Web.UI.HtmlControls" %>
    <%@ Import Namespace = "System.Data" %>
    <%@ Import Namespace = "MySql.Data" %>
    <%@ Import Namespace = "MySql.Data.MySqlClient" %>

    <script Language="C#" runat="server">

    void Page_Load(object sender, System.EventArgs e)
    {

    titletext2.Text = titletext.Text = "&quot;Upload & Resample On-Fly, delle immagini inviate, su di una cartella del Server&quot; [v.1.0.0]";
    }

    bool IsImage(string fileName)
    {
    string ext = Path.GetExtension(fileName).ToLower();
    bool imageFlag = false;

    if (ext != null)
    {
    switch (ext)
    {
    case ".emf" :
    case ".exif" :
    case ".ico" :
    case ".wmf" :
    case ".png" :
    case ".gif" :
    case ".bmp" :
    case ".tiff" :
    case ".tif" :
    case ".jpeg" :
    case ".jpg" : imageFlag = true; break;

    default: imageFlag = false; break;
    } // switch (ext)
    } // if (ext != null)
    else
    imageFlag = false;

    return imageFlag;
    } // bool IsImage(string fileName)


    void UploadAndResizeAnImage(HttpPostedFile file, double newWidth, double newHeight, string virPath, bool overwrite)
    {
    string destPath = ".";
    double ThumbnailWidth = 64.0;
    double ThumbnailHeight = 64.0;
    bool owr = false;

    if (virPath != "") destPath = virPath;
    if (newWidth > 0) ThumbnailWidth = newWidth;
    if (newHeight > 0) ThumbnailHeight = newHeight;
    if (overwrite)
    owr = true;
    else
    owr = false;

    int pathCheck = (destPath.Substring(destPath.LastIndexOf('/') + 1)).Length;
    if (pathCheck > 0) destPath += "/";

    string fileName = Path.GetFileName(file.FileName);
    double orgImgWidth = 0.0;
    double orgImgHeight = 0.0;
    double rThumbnailWidth = 0.0;
    double rThumbnailHeight = 0.0;

    destPath = Server.MapPath(destPath);

    if ( (!File.Exists(destPath + fileName)) && (fileName.Length != 0) || (owr))
    {
    if (!IsImage(fileName))
    {
    if (fileName.Length != 0)
    Status.Text += "<span style=\"color:Red;\">File '" + fileName + "' is not a valid image format. Upload... Aborted.</span>
    ";
    return;
    } // if (!IsImage(fileName))


    using(System.Drawing.Image image = System.Drawing.Image.FromStream(file.InputStream))
    {
    rThumbnailWidth = ThumbnailWidth;
    rThumbnailHeight = ThumbnailHeight;
    orgImgWidth = image.Width;
    orgImgHeight = image.Height;

    // Se l'immagine è più piccola del Thumbnail forziamo le dimensioni di
    // quest'ultimo alle dimensioni dell'immagine.
    if (orgImgWidth < rThumbnailWidth) rThumbnailWidth = image.Width;
    if (orgImgHeight < rThumbnailHeight) rThumbnailHeight = image.Height;

    // Se le dimensioni dell'immagine e del Thumbnail corrispondono non facciamo nulla.
    // quindi se l'immagine è quadrata...
    if (image.Width != image.Height)
    {
    // Se l'immagine non è quadrata
    // continuiamo a fare i nostri controlli per calcolarne le
    // giuste dimensioni e quindi creare la nostra nuova immagine con
    // l'aspectratio corretto.

    // Se l'immagine è più larga che alta
    if (image.Width > image.Height)
    {
    // L > H => L = tL
    // La larghezza del TN sarà quella da noi stabilita
    // quindi dobbiamo solo assegnarla.
    rThumbnailWidth = rThumbnailWidth;
    // L'altezza del TN invece dovrà essere ricalcolata
    // in proporzione alla larghezza dell'immagine originale.
    // L > H => tH = (H * tL)/ L
    rThumbnailHeight = (double)((image.Height * rThumbnailWidth) / image.Width);
    } // if (tmpImage.Width > tmpImage.Height)
    else
    {
    // Altrimenti se l'immagine è più alta
    if (image.Width < image.Height)
    {
    // L < H => H = tH
    // L'altezza del TN sarà quella da noi stabilita
    // quindi dobbiamo solo assegnarla.
    rThumbnailHeight = rThumbnailHeight;
    // La larghezza del TN invece dovrà essere ricalcolata
    // in proporzione alla altezza dell'immagine originale.
    // L < H => tL = (L * tH)/ H
    rThumbnailWidth = (double)((image.Width * rThumbnailHeight) / image.Height);
    } // if (image.Width < image.Height)
    } // else
    } // if (image.Width != image.Height)

    using(Bitmap bitmap = new Bitmap(image, (int)(rThumbnailWidth), (int)(rThumbnailHeight)))
    {
    string message = "Uploaded";
    if (File.Exists(destPath + fileName) && (owr)) message = "OverWritted";

    bitmap.Save(destPath + fileName, image.RawFormat);
    Status.Text += "<span style=\"color:Green;\">File '" + fileName + " &#64; [" + (int)(orgImgWidth) + "px X " + (int)(orgImgHeight) + "px]' " + message + " with this new size [" + (int)(rThumbnailWidth) + "px X " + (int)(rThumbnailHeight) + "px]</span>
    ";
    } // using(Bitmap bitmap = new Bitmap(image, (int)(rThumbnailWidth), (int)(rThumbnailHeight)))
    } // using(System.Drawing.Image image = System.Drawing.Image.FromFile(file))
    } // if ( (!File.Exists(destPath + fileName)) && (fileName != "") || (owr))
    else
    {
    if (File.Exists(destPath + fileName) && (!owr))
    Status.Text += "<span style=\"color:Red;\">Error : The file \"<u>" + fileName + "</u>\" already exist... Upload Aborted.</span>
    ";
    }
    } // void UploadImage(HttpPostedFile file)


    protected void SubmitButton_Click(Object sender, EventArgs e)
    {
    HttpFileCollection uploadedFiles = Request.Files;

    Status.Text = "";

    for (int i = 0; i < uploadedFiles.Count; i ++)
    {
    UploadAndResizeAnImage(uploadedFiles[i], 800.0, 600.0, "./immagini/", false);
    }
    string nomedelfile = Path.GetFileName(uploadedFiles[0].FileName);

    MySqlConnection connection = new MySqlConnection();
    connection.ConnectionString = "Data Source=localhost; Database=xxxx; User ID=xxxx; password=xxxxxx";
    connection.Open();

    DateTime dtmDate = new DateTime();
    dtmDate = DateTime.Now;
    string prova = dtmDate.ToString( "s" );
    string SQL = "INSERT INTO xxxx (nome, data_ins, valido, vuolevoti, accettacond) VALUES ('" + nomedelfile + "', '" + prova + "', 'NO', 'NO', 'SI')";
    Status.Text = SQL;
    MySqlCommand comando = new MySqlCommand(SQL, connection);

    comando.CommandText = SQL;
    try
    {
    comando.ExecuteNonQuery();
    }
    catch (Exception ex)
    {
    Response.Write(ex.ToString());
    }
    finally
    {
    connection.Close();
    }


    }
    </script>

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
    <html>
    <head>
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <title><asp:Literal id="titletext" runat="server"/></title>
    <style type="text/css">
    body
    {
    background:#2288DD;
    }
    a:link
    {
    color: Blue;
    text-decoration: none;
    }
    a:active
    {
    color: Blue;
    text-decoration: none;
    }
    a:visited
    {
    color: Blue;
    text-decoration: none;
    }
    a:hover
    {
    color: Blue;
    font-weight: bold;
    text-decoration: none;
    }
    </style>
    </head>

    <body>

    <div align="center">
    <h2><asp:Literal id="titletext2" runat="server"/></h2>
    <form name="inviafile" id="inviafile" enctype="multipart/form-data" runat="server">

    Select File1:
    <input id="File1" type="file" runat="Server"/>



    <div align="center"><input id="Submit1" type="submit" value="Upload Files" runat="Server" onserverclick="SubmitButton_Click"/></div>


    <asp:Label id="Status" runat="server"></asp:Label>
    </form>
    </div>
    </body>
    </html>
    --------------------------
    Mi da questo errore:
    Server Error in '/' Application.
    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".



    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.



    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>
    --------------------------
    Ma la pagina Web.Config c'è e è la seguente:
    <?xml version="1.0"?>

    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    <compilation debug="false">
    <assemblies>
    <add assembly="System, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Data, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
    <add assembly="System.Drawing, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies>
    </compilation>
    <authorization>
    <allow users="*"/>
    </authorization>
    </system.web>
    </configuration>

    Questo è il tutto...

    Quale può essere il problema??

    Grazie, Kuilsera

  4. #4
    Dunque...
    Per quanto riguarda lo script per l'uploa delle immagini e resize al volo
    problemi non che ne sono (l'ho scritto io ) il problema sta probabilmente
    nella parte dove hai inserito il codice per immettere i valori nel DB MySQL.
    Prima però scopriamo che Framework hai sul server, per farlo copia ed
    incolla questo codice in una nuova pagina .aspx che ne so "test.aspx"
    Codice PHP:
    <%@ Page Language="C#" LCID="1040" Debug="True" Trace="True" %>
    <%@ 
    Import NameSpace="System" %>
    <%@ 
    Import NameSpace="System.IO" %>

    <
    script Language "C#" runat "server">
     
    void Page_Load(Object senderEventArgs e)
      {
       
    Response.Write(String.Format(".Net Framework CLR Version : {0}</br>\r\n"Environment.Version.ToString()));
       
    Response.Write("</br>");
      }
    </script>

    <html>
     <head>
      <meta HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
     </head>
     <body bgcolor="Silver" text="black" link="blue" alink="blue" vlink="blue">
     </body>
    </html> 
    Con questo scopri la versione esatta (se presente sul server ovviamente )

    Poi mi sa tanto che il problema sia con il connector MySql....
    Il problema è che non tutti i fornitori di hosting permettono di eseguire
    il connector o altre applicazioni...
    Con Aruba so che serve un versione ricompilata del connector per permettere
    le "partially trusted calls"...
    Su Register non è possibile nemmeno così e bisogna usare obbligatoriamente l'Odbc.

    Controlla queste cose... lo script l'ho provato sia in locale che sul mio server, in locale il
    connector online l'Odbc, e posso assicurarti che funziona che una meraviglia.
    I dati vengono inseriti correttamente.

    Fammi sapere
    Richard B. Riddick : "Non avrete mica paura del buio?"

    Scusatemi ma sono mesi che non pago piu' la bolletta della luce....

  5. #5
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    91
    Dunque ho copiato il tuo script nella pagina prova.aspx...

    E come puoi vedere da questo link http://areademo.verticaltech.it/arch...ino/prova.aspx, la situazione non cambia...

    Mi dà sempre il solito errore:


    Server Error in '/' Application.
    --------------------------------------------------------------------------------

    Runtime Error
    Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

    Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".




    <configuration>
    <system.web>
    <customErrors mode="Off"/>
    </system.web>
    </configuration>


    Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.




    <configuration>
    <system.web>
    <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
    </system.web>
    </configuration>


    Come mai?

  6. #6
    ok!
    Allora crea un file "Web.Config" con dentro :

    Codice PHP:


    <configuration>
        <
    system.web>
            <
    customErrors mode="Off"/>
        </
    system.web>
    </
    configuration
    poi riprova... almeno vediamo in chiaro che errore ti da.

    a dopo.
    Richard B. Riddick : "Non avrete mica paura del buio?"

    Scusatemi ma sono mesi che non pago piu' la bolletta della luce....

  7. #7
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    91
    Rieccomi...

    Ho messo nel file Web.Config il codice che mi hai dato...ma il risultato non cambia

    Per vedere anche te, vai pure al link che ti ho passato prima.

    Come possiamo fare?

  8. #8
    Allora il problema è che il Web.Config dovresti metterlo nella root del tuo dominio
    e non nella sottocartella dove hai la pagina di prova.
    Quindi onde evitare di fare danni edita, se esiste già, il file Web.Config
    che si trova nella radice del dominio sostituendo :

    Codice PHP:
    <customErrors mode="RemoteOnly" etc..../> 
    con
    Codice PHP:
    <customErrors mode="Off"/> 
    poi riprova.
    Se non esiste creane uno nuovo con il codice precedentemente postato.

    Richard B. Riddick : "Non avrete mica paura del buio?"

    Scusatemi ma sono mesi che non pago piu' la bolletta della luce....

  9. #9
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    91
    Ciao,

    non ho capito una cosa....

    il file Web.Config io l'ho messo nella cartella dove è presente la index del sito. Non va bene?

    Perchè più in alto non posso accedere.

    Come mi comporto allora?

    Ma nel Web.Config che mi sono creato devo sostituire <customErrors mode="Off"/> con <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> , giusto??

    Ma al posto di mycustompage.htm, che devo mettere?

    Grazie infinite

  10. #10
    Originariamente inviato da Kuilsera
    Ciao,

    non ho capito una cosa....

    il file Web.Config io l'ho messo nella cartella dove è presente la index del sito. Non va bene?

    Perchè più in alto non posso accedere.

    Come mi comporto allora?

    Ma nel Web.Config che mi sono creato devo sostituire <customErrors mode="Off"/> con <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> , giusto??

    Ma al posto di mycustompage.htm, che devo mettere?

    Grazie infinite
    A regola dovresti lasciarlo su mode="Off" poi se vuoi puoi provare a
    mettere "RemoteOnly" ma senza il "defaultRedirect"...
    Comunque sia... è molto strano... :master:
    Prova a chiedere più dettagli ai signori che ti forniscono l'hosting...

    Tipo se puoi usare il connector di MySql, la versione del .Net framework, etc...

    Una cosa, che davo per scontata..., la cartella dove salvi i file è impostata
    in lettura e scrittura????
    Se sì, non so più che pesci pigliare.....
    prova ad impostare mode="RemoteOnly" e contattami nuovamente vediamo
    un pò che succede....
    Richard B. Riddick : "Non avrete mica paura del buio?"

    Scusatemi ma sono mesi che non pago piu' la bolletta della luce....

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.