【问题标题】:Forms based security and uploading asp.net web site基于表单的安全和上传 asp.net 网站
【发布时间】:2010-09-20 15:28:58
【问题描述】:

为了学习vb.net和asp.net,我写了一个小网站,非常满意,所以租了一些空间并上传了它,它是使用asp.net express edition 2008和sql server express编写的....我已经上传了它,我发现它是用 .NET 3.5 编写的,而我的主机只处理 2.01 ...我已经整理了大部分内容,并将我的 web.config 文件修剪回基础知识,但我的基于表单的身份验证不起作用

<compilation debug="true" strict="false" explicit="true">
        </compilation>
        <authentication mode="Forms" />
    <customErrors mode="Off"/>
  </system.web>

而且一直报告sql server 不支持远程访问……不知道接下来要做什么,我不用自己写安全例程吧?我有一个 sql server 后端

感谢您的宝贵时间

克里斯

【问题讨论】:

    标签: asp.net security


    【解决方案1】:

    如果问题是您无法访问 SQL Server,可能是因为您使用的是受信任的连接?

    如果网站在 ISP 网络上而您的 SQL Server 在另一个网络上,则它可能无法正常工作。

    然后您需要做的是查看您的连接字符串以更改它,以便您在连接字符串中传递用户名/密码。注意:这在安全性方面不是最佳的,但它是访问另一个域中的远程 SQL Server 的一种方式。

    /乔基姆

    【讨论】:

    • 您好,谢谢 正在使用的连接字符串不是受信任的连接字符串(包含 IP 地址、用户名和密码),适用于站点上的所有其他页面,但不适用于 asp.net 身份验证/登录控件
    【解决方案2】:

    您是否使用 SqlMembershipProvider 将用户存储在数据库中?检查您的配置文件部分并确保 connectionStringName 引用您的连接字符串的名称。

    【讨论】:

    • 欢呼声为我指明了正确的方向,但现在所有页面都指向我的登录页面......这不会让我登录......但至少它是朝着正确方向迈出的一步:- )
    【解决方案3】:

    为您的帮助干杯,将我的 web.config 更改为

    <?xml version="1.0"?>
    <configuration>
        <appSettings/>
      <connectionStrings>
        <add name="DatebaseConnectionString" connectionString="ohh wouldn't you like to know" />
      </connectionStrings>
        <system.web>
            <roleManager enabled="true" />
      <compilation debug="true" strict="false" explicit="true">
            </compilation>
        <pages>
          <namespaces>
            <clear/>
            <add namespace="System"/>
            <add namespace="System.Collections"/>
            <add namespace="System.Collections.Generic"/>
            <add namespace="System.Collections.Specialized"/>
            <add namespace="System.Configuration"/>
            <add namespace="System.Text"/>
            <add namespace="System.Text.RegularExpressions"/>
            <add namespace="System.Web"/>
            <add namespace="System.Web.Caching"/>
            <add namespace="System.Web.SessionState"/>
            <add namespace="System.Web.Security"/>
            <add namespace="System.Web.Profile"/>
            <add namespace="System.Web.UI"/>
            <add namespace="System.Web.UI.WebControls"/>
            <add namespace="System.Web.UI.WebControls.WebParts"/>
            <add namespace="System.Web.UI.HtmlControls"/>
          </namespaces>
        </pages>
            <authentication mode="Forms" />
        <membership defaultProvider="SqlProvider">
           <providers>
              <add connectionStringName="DatebaseConnectionString" applicationName="pedalpedalpuffpuff.com"
                 enablePasswordRetrieval="false" enablePasswordReset="true"
                 requiresQuestionAndAnswer="true" requiresUniqueEmail="true"
                 passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10"
                 name="SqlProvider" type="System.Web.Security.SqlMembershipProvider" />
           </providers>
        </membership>
        <customErrors mode="Off"/>
      </system.web>
    </configuration>
    

    一切正常

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-04-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多