通过一个URI到AuthenticationContext

问题描述:

嘿,对不起我的英语不好...通过一个URI到AuthenticationContext

我创建了一个新的Silverlight业务应用程序,并且所有工作都正常。我有2个DomainServices,一个公开我的数据库对象,另一个是默认的AuthenticationDomainService。问题是我必须在不同于Silverlight应用程序的服务器上运行此服务......当我创建我的DomainContext来查询数据时,我使用接受指定服务器URI的URI的构造函数,这可行,但我不知道如何为AuthenticationContext做它,因为它不是我实例化它(当我访问“WebContext.Current.Authentication”时它看起来像是自动创建的)...我怎样才能覆盖这个并传递正确的URI?

为了使用构造函数与URI做到以下几点:

WebContext webContext = new WebContext(); 
webContext.Authentication = new FormsAuthentication(); 
this.ApplicationLifetimeObjects.Add(webContext); 

设置使用URI这样的背景下AuthenticationDomain:

((WebAuthenticationService)WebContextBase.Current.Authentication).DomainContext = new AuthenticationContext(new Uri(uriPath)); 

创建Web上下文后