I'm currently migrating an enterprise content management system that was built on Sharepoint 2007 to Sharepoint 2010. The system contains a custom forms based authentication provider and a custom role provider. User-role mappings are stored in the DB like below:
userID roleID siteURL
21 15 www.sitea.com
21 10 www.siteb.com
22 15 www.sitea.com
In the role provider the role that the is assigned to in the current site is get and set through site URL. This was solved by setting a custom property (e.g. property named SiteURL) of the role provider in its Initilize method like the following:
SiteURL = SPContext.Current.Web.Url;
However, in Sharepoint 2010 that line could not be used anymore. Because in Sharepoint 2010 claims authorization, custom role provider is called in a seperate web service named SecurityToken web service. So SPContext.Current is null.
Now I have to find an alternate way to get the site url that is requesting authentication. Would you provide me any suggestions?