窗体身份验证不起作用。当SMF试图访问服务器上需要特定用户角色的*..ism/Manifest文件时,Auth cookie不会发送到服务器。
我所做的: 1.创建新的Silverlight平滑流模板,支持RIA WCF。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> 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 (大兔子)中指定的默认视频时,一切都很好。但是,当我将mediasource更改为服务器上的受限制区域的路径时,就会得到一个访问错误。在客户端,我成功地获得了用户凭据。
Fiddler展示了下一步:当我尝试访问RIA上的另一个撤销的方法(RequiresAuthentication)时,客户端会发送Auth,但是当SMFPlayer尝试访问媒体源时,就不会发送该cookie。
我错过了什么?
发布于 2012-01-08 19:52:07
我找到了一些解决办法:如果将流文件传输到子目录中,并限制对它的访问(而不是带有"ism“文件的目录)。清单将颁发给匿名用户,但数据流仅用于注册(当播放器尝试触摸数据流时,它成功地附加了auth cookie)。
https://stackoverflow.com/questions/8693700
复制相似问题