2009-08-17 60 views
0

我想了解關於asp.net成員資格的密碼恢復技術。asp.net密碼恢復不起作用

這是我的web.config文件:

<?xml version="1.0"?> 
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use 
    the Website->Asp.Net Configuration option in Visual Studio. 
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
--> 
<configuration> 
    <appSettings/> 
    <connectionStrings> 
    <remove name="LocalSqlServer"/> 
    <add name="LocalSqlServer" connectionString="Data Source=localhost;Initial Catalog=aspnet_membership_test;Integrated Security=True" providerName="System.Data.SqlClient"/> 
    </connectionStrings> 
    <system.web> 
     <!-- 
      Set compilation debug="true" to insert debugging 
      symbols into the compiled page. Because this 
      affects performance, set this value to true only 
      during development. 
     --> 
     <compilation debug="true"/> 
     <!-- 
      The <authentication> section enables configuration 
      of the security authentication mode used by 
      ASP.NET to identify an incoming user. 
     --> 
    <authentication mode="Forms"> 
     <forms loginUrl="~/Login.aspx">   
     </forms>  
    </authentication> 
    <authorization> 
     <allow users="*"/>  
    </authorization> 
     <!-- 
      The <customErrors> section enables configuration 
      of what to do if/when an unhandled error occurs 
      during the execution of a request. Specifically, 
      it enables developers to configure html error pages 
      to be displayed in place of a error stack trace. 

     <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm"> 
      <error statusCode="403" redirect="NoAccess.htm" /> 
      <error statusCode="404" redirect="FileNotFound.htm" /> 
     </customErrors> 
     --> 
    </system.web> 

    <location path="SecuredPage.aspx"> 
    <system.web> 
     <authorization> 
     <deny users="?"/> 
     </authorization> 
    </system.web> 
    </location> 

    <system.net> 
    <mailSettings> 
     <smtp deliveryMethod="Network" from="[email protected]"> 
     <network host="mail.yahoo.com" 
     port="25" defaultCredentials="true"/> 
     </smtp> 
    </mailSettings> 
    </system.net> 




</configuration> 

但我正在逐漸從IIS這個錯誤:

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

An established connection was aborted by the software in your host machine 69.147.112.160: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 established connection was aborted by the software in your host machine 69.147.112.160: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 (0x2745): An established connection was aborted by the software in your host machine 69.147.112.160:25] 
    System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) +198 
    System.Net.Sockets.Socket.InternalConnect(EndPoint remoteEP) +60 
    System.Net.ServicePoint.ConnectSocketInternal(Boolean connectFailure, Socket s4, Socket s6, Socket& socket, IPAddress& address, ConnectSocketState state, IAsyncResult asyncResult, Int32 timeout, Exception& exception) +579 

[WebException: Unable to connect to the remote server] 
    System.Net.ServicePoint.GetConnection(PooledStream PooledStream, Object owner, Boolean async, IPAddress& address, Socket& abortSocket, Socket& abortSocket6, Int32 timeout) +406 
    System.Net.PooledStream.Activate(Object owningObject, Boolean async, Int32 timeout, GeneralAsyncDelegate asyncCallback) +288 
    System.Net.PooledStream.Activate(Object owningObject, GeneralAsyncDelegate asyncCallback) +46 
    System.Net.ConnectionPool.GetConnection(Object owningObject, GeneralAsyncDelegate asyncCallback, Int32 creationTimeout) +429 
    System.Net.Mail.SmtpConnection.GetConnection(String host, Int32 port) +333 
    System.Net.Mail.SmtpTransport.GetConnection(String host, Int32 port) +287 
    System.Net.Mail.SmtpClient.GetConnection() +56 
    System.Net.Mail.SmtpClient.Send(MailMessage message) +1679 

[SmtpException: Failure sending mail.] 
    System.Net.Mail.SmtpClient.Send(MailMessage message) +2246 
    System.Web.UI.WebControls.LoginUtil.SendPasswordMail(String email, String userName, String password, MailDefinition mailDefinition, String defaultSubject, String defaultBody, OnSendingMailDelegate onSendingMailDelegate, OnSendMailErrorDelegate onSendMailErrorDelegate, Control owner) +482 
    System.Web.UI.WebControls.PasswordRecovery.AttemptSendPasswordQuestionView() +748 
    System.Web.UI.WebControls.PasswordRecovery.AttemptSendPassword() +106 
    System.Web.UI.WebControls.PasswordRecovery.OnBubbleEvent(Object source, EventArgs e) +136 
    System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56 
    System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107 
    System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +178 
    System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31 
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32 
    System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72 
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3825 




-------------------------------------------------------------------------------- 
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433 

可能是什麼問題呢?

回答

1

它看起來像你試圖發送您的電子郵件使用雅虎的服務器。如果你還沒有註冊他們的高級郵件,你將不被允許這樣做。

檢查出正確設置它,這個參考如果你有服務:

http://help.yahoo.com/l/us/yahoo/mail/classic/mailplus/pop/pop-14.html

+0

也許你是對的。但是,我該如何測試這種會員身份功能(即,無需在雅虎或任何其他提供商註冊)呢? – 2009-08-17 19:41:57

+0

您需要設置您的本地IIS以啓用SMTP並將其用作您的郵件服務器。或者,找一個能夠給你免費的SMTP賬戶的人,比如gmail。 http://lifehacker.com/111166/how-to-use-gmail-as-your-smtp-server – womp 2009-08-17 19:53:46

0

我認爲你使用雅虎SMTP服務器的錯誤端口。根據this link你應該使用端口465.

+0

您的解決方案是行不通的。 – 2009-08-17 19:38:20