Pourquoi ce code:nouvelle MailMessage() throws 'La poignée est invalide'
MailMessage mm = new MailMessage();
Throw cette exception:
System.Security.Cryptography.CryptographicException was caught
Message=The handle is invalid.
Source=mscorlib
StackTrace:
at System.Security.SecureString.ProtectMemory()
at System.Security.SecureString.InitializeSecureString(Char* value, Int32 length)
at System.Security.SecureString..ctor(Char* value, Int32 length)
at System.Net.UnsafeNclNativeMethods.SecureStringHelper.CreateSecureString(String plainString)
at System.Net.Configuration.SmtpNetworkElementInternal..ctor(SmtpNetworkElement element)
at System.Net.Configuration.SmtpSectionInternal..ctor(SmtpSection section)
at System.Net.Configuration.SmtpSectionInternal.GetSection()
at System.Net.Mail.SmtpClient.get_MailConfiguration()
at System.Net.Mail.MailMessage..ctor()
at csEmail.GetMailMessage(String subject, String htmlbody) in c:\Users\Greg\My Dropbox\Intern Files\mobiledesign\App_Code\Utilities.cs:line 364
InnerException:
Mon Web.config
<smtp deliveryMethod="Network" from="correctAddress">
<network host="smtp.gmail.com" userName="correctAddress" password="correctPassword" enableSsl="true" port="587"/>
</smtp>
Que dit votre web.config dans la section smtp? – tedski