简体   繁体   中英

How to get the SharePoint authenticated user from an ASP.NET webpage?

I am kind of new to this, and I'm still trying to figure out how the whole thing works.

I have a sharepoint site, and I also have separate ASP webpages, they are under the same domain, but different servers. They both authenticate to AD.

I thought that by having my webpages under the same domain as the sharepoint, once I had an user authenticate to sharepoint (windows authentication), my webpages would be able to find who that was, as long as they had windows authentication also. But I guess it doesn't work like that.

So, my main goal is: from an ASP.NET page, I want to be able to get the authentication info from SharePoint.

What should I do?

Thanks!

The users are authenticated by thier login credentials with AD. In a C# ASP.Net page you can get thier username from System.Web.HttpContext.Current.User.Identity.Name

You can use this information to make a web service call to the SharePoint User Profile Service in order to get details SharePoint records on that user. This assumes that the user profile services is installed and running (not a given).

As for authentication information, you will need to be more specific about which information. Remember that the rights given to a given AD user differ completely between what is permissioned for SharePoint and anything you have for the ASP.Net website.

If you are wanting to get information on what permissions a given user has, you can use the SharePoint Permissions web service to get information on what permission there are. Unfortunately, accessing that webservice requires elevated rights on the SharePoint server.

If you are just wanting to align the two sites so they have consistent permissions, your easiest bet is to create the relevant groups in AD and permission those groups independantly in each application.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM