IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP.NET Discussion :

Runtime error mail envoyé et export excel


Sujet :

ASP.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2016
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mai 2016
    Messages : 147
    Par défaut Runtime error mail envoyé et export excel
    Bonjour,

    Je vais vous parler pour le moment que du problème mail parce que à mon avis c'est en rapport l'export excel. Alors voici le code de mon envoie de mail :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    Dim LeClient As UnClient = outils.RecuperationClient(Request.QueryString("ResC"))
     
                Dim client As New System.Net.Mail.SmtpClient
                Dim message As New System.Net.Mail.MailMessage
                client.Credentials = New System.Net.NetworkCredential("**", "**")
     
                client.Port = 25
                client.Host = "smtp.gmail.com"
                client.EnableSsl = True
                message.From = New System.Net.Mail.MailAddress("**")
                message.To.Add(LeClient._Mail)
     
                message.Subject = "Bienvenue chez défibril"
                message.Body = LeClient._Civilite & " " & LeClient._Nom & " " & LeClient._Prenom & ". Nous vous souhaitons la bienvenue chez défibril. Un compte client vient d'être créé pour vous, voici les identifiants de connexion à conserver : Identifiant > " & LeClient._Mail & " Mot de passe > " & LeClient._MotDePasse & ". A bientôt sur défibril."
     
                client.Send(message)
    Ce code fonctionne très bien en local quand je fais démarrer sour un navigateur mais quand je publie mon projet sur Internet ça ne fonctionne plus et j'ai l'erreur global :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    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".
     
     
    <!-- Web.Config Configuration File -->
     
    <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.
     
     
    <!-- Web.Config Configuration File -->
     
    <configuration>
        <system.web>
            <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
        </system.web>
    </configuration>
    Je ne comprend pas vraiment ce qui manque pour qu'en ligne cela fonctionne, j'ai le même problème avec un export excel, ça fonctionne très bien en local mais pas en ligne.

    Merci de votre aide.

    Cordialement

  2. #2
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    Peux tu mettre un try catch et poster la véritable erreur...

  3. #3
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2016
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mai 2016
    Messages : 147
    Par défaut
    C'est ce que je voulais faire car avec une vrai erreur je pourrais m'en sortir mais en local avec mon try catch aucune erreur et tout ce passe correctement, je reçois le mail avec tous les éléments. Mais même avec un try catch en ligne il ne va pas dedans (je suppose) et il me met cette erreur je ne comprends pas. J'ai l'impression qu'il n'y a pas de véritable erreur. Et qu'il fasse la même chose avec un export excel je trouve ça étonnant. Quelle est la différence en local et en ligne ? Il lui manque quelque chose en ligne pour qu'il traite le excel et les mails ?

  4. #4
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    Citation Envoyé par dwlapp Voir le message
    C'est ce que je voulais faire car avec une vrai erreur je pourrais m'en sortir mais en local avec mon try catch aucune erreur et tout ce passe correctement, je reçois le mail avec tous les éléments. Mais même avec un try catch en ligne il ne va pas dedans (je suppose) et il me met cette erreur je ne comprends pas. J'ai l'impression qu'il n'y a pas de véritable erreur. Et qu'il fasse la même chose avec un export excel je trouve ça étonnant. Quelle est la différence en local et en ligne ? Il lui manque quelque chose en ligne pour qu'il traite le excel et les mails ?
    Il manque p-e une dll ou autre chose mais essaye de changer ton web.config pour afficher l'erreur...(customerror=off)

  5. #5
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2016
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mai 2016
    Messages : 147
    Par défaut
    Voila l'erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    Server Error in '/' Application.
    An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25
    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.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25
     
    Source Error:
     
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
     
    Stack Trace:
     
     
    [SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25]
       System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +185
       System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +506
     
    [WebException: Unable to connect to the remote server]
       System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) +6524156
       System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) +302
       System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +23
       System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +328
       System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +141
       System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +236
       System.Net.Mail.SmtpClient.GetConnection() +45
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1574
     
    [SmtpException: Failure sending mail.]
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1916
       DWL.edition2.btnEnvoiMailMdp_Click(Object sender, EventArgs e) +596
       System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +106
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9754102
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3562

  6. #6
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    Citation Envoyé par dwlapp Voir le message
    Voila l'erreur

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    Server Error in '/' Application.
    An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25
    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.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25
     
    Source Error:
     
    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
     
    Stack Trace:
     
     
    [SocketException (0x271d): An attempt was made to access a socket in a way forbidden by its access permissions 74.125.206.109:25]
       System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +185
       System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Exception& exception) +506
     
    [WebException: Unable to connect to the remote server]
       System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6) +6524156
       System.Net.PooledStream.Activate(Object owningObject, Boolean async, GeneralAsyncDelegate asyncCallback) +302
       System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +23
       System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +328
       System.Net.Mail.SmtpConnection.GetConnection(ServicePoint servicePoint) +141
       System.Net.Mail.SmtpTransport.GetConnection(ServicePoint servicePoint) +236
       System.Net.Mail.SmtpClient.GetConnection() +45
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1574
     
    [SmtpException: Failure sending mail.]
       System.Net.Mail.SmtpClient.Send(MailMessage message) +1916
       DWL.edition2.btnEnvoiMailMdp_Click(Object sender, EventArgs e) +596
       System.Web.UI.WebControls.LinkButton.OnClick(EventArgs e) +116
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +106
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +12
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +15
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +9754102
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3562
    Tu dois ouvrir le port dans le firewall pour envoyer tes mails...

  7. #7
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    dans ton code tu indiques le port 25...

  8. #8
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2016
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mai 2016
    Messages : 147
    Par défaut
    Si tu regarde mon premier code dans mon code j'ai mis le port 25

  9. #9
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    Citation Envoyé par dwlapp Voir le message
    Si tu regarde mon premier code dans mon code j'ai mis le port 25
    Heu, oui c'est ce que je disais dans mon post...il n'est pas ouvert dans le firewall, remplace par 587 si c'est celui que tu as ouvert et ca devrait fonctionner...

    Le code devient :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    ...
    
    client.Port = 587; // Et non pas 25
    ...

  10. #10
    Membre confirmé
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2016
    Messages
    147
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 37
    Localisation : France, Vendée (Pays de la Loire)

    Informations professionnelles :
    Activité : Développeur .NET

    Informations forums :
    Inscription : Mai 2016
    Messages : 147
    Par défaut
    Oui je comprends bien ^^ mais apres m'a demandé cest comment ouvrir le port 25 ou 587. J'utilise Gmail pour le moment, faut t'il que j'ouvre quelque chose ici. J'envoie uniquement donc il y a qu'un probleme smtp. Ah moins que cest sur mon hébergeur la configuration?

  11. #11
    Membre émérite
    Profil pro
    Inscrit en
    Novembre 2003
    Messages
    777
    Détails du profil
    Informations personnelles :
    Âge : 43
    Localisation : Belgique

    Informations forums :
    Inscription : Novembre 2003
    Messages : 777
    Par défaut
    Citation Envoyé par dwlapp Voir le message
    Oui je comprends bien ^^ mais apres m'a demandé cest comment ouvrir le port 25 ou 587. J'utilise Gmail pour le moment, faut t'il que j'ouvre quelque chose ici. J'envoie uniquement donc il y a qu'un probleme smtp. Ah moins que cest sur mon hébergeur la configuration?
    C'est le port de l’hébergeur qui doit être ouvert. Ca ne peux être fais que dans son firewall...

Discussions similaires

  1. Runtime Error lors d'un export avec le wizard
    Par stamia dans le forum Administration-Migration
    Réponses: 1
    Dernier message: 06/05/2011, 13h44
  2. [Mail] Envoyer un tableau excel par mail
    Par dam28800 dans le forum Langage
    Réponses: 1
    Dernier message: 01/07/2009, 15h05
  3. Réponses: 1
    Dernier message: 27/06/2009, 14h05
  4. export excel trop de données à envoyer
    Par laurent.w dans le forum Access
    Réponses: 9
    Dernier message: 06/02/2007, 21h22
  5. Réponses: 4
    Dernier message: 13/07/2006, 10h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo