2

登録とログイン機能を持つ ASP.NET Web サイトを開発しようとしています。これを行うために、このガイドに従ってメンバーシップを使用しています。

http://msdn.microsoft.com/en-us/library/ff648345.aspx

データベースを実行Aspnet_regsql.exeしてセットアップし、Web.configこれを反映するようにファイルごとに変更しました。

<connectionStrings>
    <add name="MsSqlConnection" connectionString="Data Source=fostvm;Initial Catalog=db_74;User ID=user74;password=mypassword;Integrated Security=SSPI;" />
</connectionStrings>
<authentication mode="Forms">
  <forms loginUrl="Account/Login.aspx"
         protection="All"
         timeout="30"
         name="AppNameCookie"
         path="/FormsAuth"
         requireSSL="false"
         slidingExpiration="true"
         defaultUrl="default.aspx"
         cookieless="UseCookies"
         enableCrossAppRedirects="false" />
</authentication>
<authorization>
  <deny users="?" />
  <allow users="*" />
</authorization>
<membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
  <providers>
    <clear />
    <add
      name="SqlProvider"
      type="System.Web.Security.SqlMembershipProvider"
      connectionStringName="MsSqlConnection"
      applicationName="WebSite10"
      enablePasswordRetrieval="false"
      enablePasswordReset="true"
      requiresQuestionAndAnswer="true"
      requiresUniqueEmail="true"
      passwordFormat="Hashed" />
  </providers>
</membership>

ログインまたは登録ページのロード中にエラーは発生しませんが、ダミーのアカウント データでログインしようとすると、次のエラーがスローされます。

Login failed. The login is from an untrusted domain and cannot be used with Windows authentication.

私はそれをグーグルで検索し、さまざまなフォーラムやブログから多数のスレッドを見つけましたが、解決策はありませんでした.

設定に見逃した明らかなエラーはありますか?

ありがとう。

4

1 に答える 1

0

私の推測では、接続文字列にあると思います。

Data Source=fostvm;Initial Catalog=db_74;User ID=user74;password=mypassword;Integrated Security=SSPI;

そして、誰かが私を修正できますか?Integrated Security=SSPI指定すると、User IDandpasswordは無視され、Windows認証が使用されますか? この場合、匿名アクセス用のアプリケーション プール アカウントまたは IUSR_Account である可能性が高く、データベースへのアクセス許可がない可能性があります。

要約するとIntegrated Security=SSPI、接続文字列から を削除するか、次のように置き換えてみて くださいIntegrated Security=false

于 2012-10-31T20:15:44.670 に答える