开发者

Login to Sharepoint from ASP.NET site

开发者 https://www.devze.com 2023-01-12 19:35 出处:网络
I have a preexisting asp.net site that uses forms authentication.I am setting up a Sharepoint 2007 site on the same box.I would like to use my existing asp.net site authentication a开发者_运维百科nd o

I have a preexisting asp.net site that uses forms authentication. I am setting up a Sharepoint 2007 site on the same box. I would like to use my existing asp.net site authentication a开发者_运维百科nd once logged in provide a link to the sharepoint site that has the user auto-logged in.

It doesn't matter to me if Windows or Forms auth is used. I tried a couple different things to pass credentials through the response, but was unable to obtain success. Has anyone done anything similar. The tutorials for configuring forms auth on sharepoint just seem over the top and quite unreasonable. There has to be an easier way to either pass credentials or configure custom authentication.

Any assistance or tips are greatly appreciated.


I'd say you have a couple of options.

If your asp.net site and your sharepoint site share the same parent domain then you can set your forms authentication cookie to the parent domain and it will be valid on both. So site1.example.com and site2.example.com can both read a cookie scoped to .example.com

System.Web.HttpCookie authcookie = System.Web.Security.FormsAuthentication.GetAuthCookie(UserName, False);
authcookie.Domain = "parent.com";
HttpResponse.AppendCookie(authcookie);
HttpResponse.Redirect(System.Web.Security.FormsAuthentication.GetRedirectUrl(UserName, False));

The other option would be to setup forms authenticatin in SharePoint as you normally would, but to make sure to point to the same database as your asp.net site. In this case you would have to sign in twice, but you would use the same username and password in both cases.


Out of the box this is probably not possible due to the sites being in separate Web Application Domains.

0

精彩评论

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