开发者

Pass a uri to AuthenticationContext

开发者 https://www.devze.com 2023-02-18 20:03 出处:网络
Hey, sorry for my bad english... I created a new Silverlight Business Application and all is working fine. I have 2 DomainServices, one expose my database objects and another is the default Authentic

Hey, sorry for my bad english...

I created a new Silverlight Business Application and all is working fine. I have 2 DomainServices, one expose my database objects and another is the default AuthenticationDomainService. The problem is I have to run this services on a different server than the silverlight application... when I create my DomainContext to query data, I use the constructor that accepts a URI specifying the URI to the server, this works but I do not know how to do it for the AuthenticationContext since it's not me who instantiate it (looks like开发者_运维百科 it is automagically created when I access "WebContext.Current.Authentication")... how can I override this and pass the right URI?


In order to use the ctor with URI do the following:

after creating the web context:

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

set the AuthenticationDomain Context using the URI like this:

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

精彩评论

暂无评论...
验证码 换一张
取 消