基于表单的安全性和上传asp.net网站

时间:2008-11-04 07:53:27

标签: asp.net security

我写了一个小网站,努力学习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后端

感谢您的时间

克里斯

3 个答案:

答案 0 :(得分:1)

如果问题是您无法访问SQL Server,那么您可能正在使用可信连接吗?

如果网站位于ISP网络上且您的SQL Server位于另一个网络上,则不太可能正常工作。

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

/乔金姆

答案 1 :(得分:1)

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

答案 2 :(得分:0)

为您的帮助人员干杯,将我的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>

一切正常