Asp.net忘了密码恢复 [英] Asp.net forget password recovery

查看:101
本文介绍了Asp.net忘了密码恢复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用asp的密码恢复控制,忘记密码链接在午餐时我的网络应用程序出现此错误:



SMTP服务器需要一个安全连接或客户端未经过身份验证。服务器响应是:5.5.1需要验证。



我的web.config代码就像打击一样:



i'm using asp's password recovery control and in the forget password link have a problem when lunch my web application get this error:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.5.1 Authentication Required.

my web.config code is like blow:

<configuration>
  <system.web>
    <roleManager enabled="true" />
    <authentication mode="Forms" />
    <compilation debug="true" targetFramework="4.5" />
    <httpRuntime targetFramework="4.5" />
  </system.web>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="LocalSqlServer" connectionString="Data Source=SadeQ-PC;Initial Catalog=HCSWA;Integrated Security=True;" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None" lockItem="false"/>
  </appSettings>
<system.net>
    <mailSettings>
        <smtp from="hsadeghi.t@gmail.com">
            <network host="smtp.gmail.com" password="mypassword" enableSsl="true" port="578" userName="hsadeghi.t@gmail.com" />
        </smtp>
    </mailSettings>
  </system.net>

</configuration>







我的表格代码是:




and my form code is :

<%@ Page Title="" Language="C#" MasterPageFile="~/Masters/master-store.Master" AutoEventWireup="true" CodeBehind="UserPasswordRecovery.aspx.cs" Inherits="Store.Pages.userpasswordrecovery" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitlePlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="CSSPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="JSPlaceHolder" runat="server">
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="wrapper">
        <div class="wrapper-rim">
            <div class="site-content">
                <div class="recovery-password" dir="rtl">
                    <asp:PasswordRecovery ID="PasswordRecovery1" runat="server"></asp:PasswordRecovery>
                </div>
            </div>
        </div>
    </div>
</asp:Content>





我每读一遍在谷歌搜索的帖子和教程有些人说,enableSsl必须是真实的,但它不起作用。我认为我的谷歌账户认证中存在一些问题,任何机构都有一些信息吗?

i使用.NET 4.5



I'd read every post and tutorial that been in google search some body said enableSsl have to be "true" but it wasn't work. I'd think I've some problem in my google's account authentication any body have some information?
i using .NET 4.5

推荐答案

你好Sadeq,



只是为了让你更深入地了解SMTP身份验证,这里是维基百科的一小部分。

Hello Sadeq,

Just to give you more insight on SMTP authentication here is a small excerpt from wikipedia.
来自维基百科

与邮件访问协议不同,Jon Postel在20世纪70年代指定的原始SMTP没有规定使用密码发送电子邮件。缺乏安全性导致开放邮件中继,用于传播垃圾邮件的无保护邮件服务器以及在90年代后期成为瘟疫的蠕虫。[2]在SMTP AUTH之前,必须通过IP地址识别中继客户端,这仅适用于由提供连接的同一Internet服务提供商(ISP)提供的电子邮件服务,或者使用特定的黑客攻击,例如SMTP之前的POP。 />


John Gardiner Myers于1995年发布了SMTP AUTH的初稿,并在IETF中连续开发和讨论了邮件提交协议,扩展SMTP(ESMTP),和简单身份验证和安全层(SASL)。用于ESMTP身份验证(ESMTPA)的旧SASL机制是CRAM-MD5,并且在HMAC(基于哈希的消息身份验证代码)中使用MD5算法仍然被认为是合理的。

Differently from mail-access protocols, the original SMTP specified by Jon Postel in the 1970s did not provide for using passwords for sending email messages. This lack of security gave rise to open mail relays, unprotected mail servers used to propagate spam and worms that became a plague in the late '90s.[2] Before SMTP AUTH, a relay client had to be identified by IP address, which is only practical for email services provided by the same Internet service provider (ISP) supplying the connection, or else using specific hacks, such as POP before SMTP.

John Gardiner Myers published the first draft of SMTP AUTH in 1995, and it has been successively developed and discussed in the IETF along with mail submission protocol, Extended SMTP (ESMTP), and Simple Authentication and Security Layer (SASL). An older SASL mechanism for ESMTP authentication (ESMTPA) is CRAM-MD5, and uses of the MD5 algorithm in HMACs (hash-based message authentication codes) are still considered sound.



来自错误描述看起来您的SMTP服务器不允许将其用作Open Relay&在发送电子邮件之前需要进行身份验证。您可以要求管理员允许从ASP.Net应用程序所在服务器的IP地址发送电子邮件,但这不是一个好主意。而是检查您的web.config并检查mailsettings元素。它应该如下所示:


From the error description it looks like your SMTP server does not allow it to be used as Open Relay & requires authentication before an email can be sent out. You can ask your administrator to allow sending emails from the IP address of the server on which your ASP.Net application, but it's not really a good idea. Instead check your web.config and in that check the mailsettings element. It should something like one shown below.

<mailSettings>
    <smtp deliveryMethod="network" from="ben@contoso.com">
        <network 

            host="host name"  

            port="integer"  

            defaultCredentials="true|false" 

            userName="string" 

            password="string"/>
    </mailSettings>



问候,


Regards,


已解决!!!!



i试试此代码



< system.net>

< mailsettings>

< smtp deliverymethod =Networkfrom =mymail@gmail.com>

< network>

host =smtp.gmail.com

enableSsl =true

port = 587

defaultCredentials =false

userName =mymail@gmail.com/ /同样来自

密码='mypassword'/>




SOLVED!!!!

i try this code

<system.net>
<mailsettings>
<smtp deliverymethod="Network" from="mymail@gmail.com">
<network>
host="smtp.gmail.com"
enableSsl="true"
port="587"
defaultCredentials="false"
userName="mymail@gmail.com" //same from
password='mypassword'/>



这篇关于Asp.net忘了密码恢复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆