Visualizzazione dei risultati da 1 a 4 su 4
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    3,072

    Errore doppio invio mail

    Ciao, quando cerco di inviare una elenco di mail tramite un ciclo ottengo questo errore

    The process cannot access the file 'C:\WebApplications\attachment\prova.txt' because it is being used by another process.
    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.IO.IOException: The process cannot access the file 'C:\WebApplications\RGP\attachment\prova.txt' because it is being used by another process.

    Source Error:


    Line 180: if (FileSize > 0)
    Line 181: {
    Line 182: txtUpload.PostedFile.SaveAs(Request.PhysicalApplic ationPath + "\\attachment\\" + FileName);
    Line 183: }
    Line 184: }



    Il problema è il seguente... primo invio, tutto OK ... quando provo ad eseguire la stessa operazione (cliccando nuovamente sul pulsante di invio) ottengo l'errore sopra indicato, cosa sbaglio?

    Grazie mille!

  2. #2
    Dovresti provare a gestirlo con un blocco Try... Catch (System.IO.Exception) cosi verifichi l'esatto errore e poi ti comporti di conseguenza, o comunque hai maggiori informazioni..

    ciao
    Francesco

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2006
    Messaggi
    3,072
    E' già in un try catch

    e l'errore è quello che ho postato

    "is being used by another process"

  4. #4
    prova a fare una cosa del genere

    try
    {
    ...
    }

    catch
    {
    ...
    }
    finally
    {
    mailMessage.Dispose()
    }

    Provabilmente blocca il file perche è attivo il processo, la prima volta lo fa perche ancora non ha bloccato il file...

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 © 2026 vBulletin Solutions, Inc. All rights reserved.