View Full Version : An existing connection was forcibly closed.. Error.
ezboy
03-01-2011, 02:51 PM
I am getting this error when I am setting my password recovery in my asp website hosted by discountasp.net
" An existing connection was forcibly closed by the remote host "
Here is the settings I am using.. Please let me know if I am missing something..
<system.net>
<mailSettings>
<smtp deliveryMethod="Network"
from="personalemail@gmail.com">
<network host="smtp.websiteatdiscountasp.com"
userName="user1@websiteatdiscountasp.com"
password="xxxxxxx"
port="25" />
</smtp>
</mailSettings>
</system.net>
I tried host="localhost" also in place of smtp.webs..., i get the same error.
<membership defaultProvider="xxxxxxxx">
<providers>
<add name="xxxxxxxx"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="LocalSqlServer"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="xxxxxxx"
requiresUniqueEmail="true"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="7"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="6"
passwordStrengthRegularExpression=""/>
</providers>
</membership>
In the mark up page for the password recover control, this is what I have..
<asp:PasswordRecovery ID="PasswordRecovery1" runat="server">
<MailDefinition BodyFileName="~/xxxx/Pwdreco.txt"
Subject="Password has been changed...">
</MailDefinition>
</asp:PasswordRecovery>
I need help setting this email recovery on this Discountaspnet host website... thank you for any help...
bruce
03-01-2011, 03:13 PM
switch smtp host to localhost
take out the authentication, ie. blank out the username / password
ezboy
03-01-2011, 05:43 PM
That did not fix it. I get the same error message.
wisemx
03-01-2011, 07:23 PM
Try it like this:
<system.net>
<mailSettings>
<smtp from="personalemail@gmail.com" deliveryMethod="Network">
<network host="localhost" port="25" password="xxxxxxx" userName="personalemail@gmail.com"/>
</smtp>
</mailSettings>
</system.net>
ezboy
03-01-2011, 07:52 PM
ok. I tried this also.
Same error message.
But where am I using Discounstasp.net email server and messaging system, in your solution?
Tasslehoff
03-01-2011, 09:16 PM
Try it like this as bruce suggested:
<network host="localhost" port="25" />
ezboy
03-01-2011, 09:31 PM
Well I tried again , gets me the same error message.
There is definitely something that I am doing incorrectly here.. Please see my code in the my original post.. and let me know if you need any more information.... I need to get this working.
Thank you all for your suggestions and help.
Tasslehoff
03-01-2011, 11:23 PM
Shouldn't enablePasswordRetrieval be set to true?
ezboy
03-02-2011, 03:33 AM
For passwordformat ="Hashed", PasswordRetrieval should be false.
and passwordreset should be true.
I checked the documentation again. That is how it should be for hashed passwords, because they are unretreivable... with passwordreset = true, a new password is generated and sent.
This is where I need the email settings - to send the new password to user.
wisemx
03-02-2011, 04:24 AM
...I just looked your code over again and the ASP.NET control doesn't look right.
Should be like this:
<asp:PasswordRecovery ID=PasswordRecovery1" Runat="server">
<MailDefinition From="someuser@email.com">
</MailDefinition>
</asp:PasswordRecovery>
ASP.NET examples for this control always use this in the web.config:
<smtp from="someuser@email.com>
<network host="localhost" port="25" defaultCredentials="true" />
</smtp>
ezboy
03-02-2011, 06:24 AM
I am getting the same error. I pasted the error message below. I am working on a copy on my development machine , the database is on the discountasp server ...
An existing connection was forcibly closed by the remote host
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 existing connection was forcibly closed by the remote host
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 (0x2746): An existing connection was forcibly closed by the remote host]
System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags) +6132200
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +134
[IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.]
System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size) +300
System.Net.DelegatedStream.Read(Byte[] buffer, Int32 offset, Int32 count) +45
System.Net.BufferedReadStream.Read(Byte[] buffer, Int32 offset, Int32 count) +105
System.Net.Mail.SmtpReplyReaderFactory.ReadLines(S mtpReplyReader caller, Boolean oneLine) +248
System.Net.Mail.SmtpReplyReaderFactory.ReadLine(Sm tpReplyReader caller) +16
System.Net.Mail.SmtpConnection.GetConnection(Servi cePoint servicePoint) +665
System.Net.Mail.SmtpTransport.GetConnection(Servic ePoint servicePoint) +170
System.Net.Mail.SmtpClient.GetConnection() +50
System.Net.Mail.SmtpClient.Send(MailMessage message) +1484
[SmtpException: Failure sending mail.]
System.Net.Mail.SmtpClient.Send(MailMessage message) +1811
System.Web.UI.WebControls.LoginUtil.SendPasswordMa il(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +371
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPasswordUserNameView() +566
System.Web.UI.WebControls.PasswordRecovery.Attempt SendPassword() +62
System.Web.UI.WebControls.PasswordRecovery.OnBubbl eEvent(Object source, EventArgs e) +103
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +37
System.Web.UI.WebControls.Button.OnCommand(Command EventArgs e) +125
System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +167
System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5563
Tasslehoff
03-02-2011, 10:52 AM
Sorry, I missed the passwordformat="Hashed". Can you verify that the email address you're trying to send to is valid?
ezboy
03-02-2011, 01:20 PM
Got this fixed.
Bruce's suggestion in the beginning was the solution.
Not paying attention to small details...thanks to every one who responded.
Glad you got it sorted out.
vBulletin® ©Jelsoft Enterprises Ltd.