表單身份驗證不起作用。當SMF嘗試訪問需要特定用戶角色的服務器上的* .ism/Manifest文件時,Auth cookie不會發送到服務器。Microsoft媒體平臺+表單身份驗證
我該怎麼做: 1.使用支持RIA WCF創建新的Silverlight Smooth Streaming模板。 2.配置的web.config:
<connectionStrings>
<add name="ApplicationServices" connectionString="Data Source=[SERVER];Initial Catalog=[CATALOG];User ID=[USER];Pwd=[PASSWORD];" providerName="System.Data.SqlClient" />
<system.web>
<authentication mode="Forms">
<forms loginUrl="~/Account/LogOn" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
<properties>
<add name="Gender" />
<add name="Birthday" />
<add name="AvatarPath" />
</properties>
</profile>
<roleManager enabled="true">
<providers>
<clear />
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" />
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" />
</providers>
</roleManager>
- 添加身份認證服務和正確的用戶類(添加3個道具)。
- 在客戶端添加這app.xaml.cs:
public App()
{
//Default things...
InitializeWebContext();
}
private void InitializeWebContext()
{
WebContext webContext = new WebContext();
var fa = new FormsAuthentication();
var ac = new AuthenticationDomainService1();
fa.DomainContext = ac;
fa.Login(new LoginParameters("user", "password"), (y) =>
{
if (!y.HasError)
{
this.RootVisual = new MainPage();
}
}, null);
webContext.Authentication = fa;
ApplicationLifetimeObjects.Add(webContext);
Resources.Add("WebContext", WebContext.Current);
}
的訪問是由web.config文件在目標目錄限制:在這個角色
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
<authorization>
<allow roles="Role_name" />
<deny users="*" />
</authorization>
</system.web>
</configuration>
用戶存在。
當我使用Xaml(Big Bunny)中指定的默認視頻時 - 一切都很好。但是,當我將媒體源更改爲我的服務器上受限區域的路徑時,出現訪問錯誤。 在客戶端,我成功獲取用戶憑證。
提琴手顯示下一件事: 當我嘗試訪問的WCF RIA另一個resctricted方法([RequiresAuthentication]),客戶端發送驗證的cookie,但是當SMFPlayer嘗試訪問媒體源,該cookie發送wasn`t。
我錯過了什麼?