Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Create web application and place it inside the “_layouts” folder and configure as a virtual directory in your SharePoint site but we have to use the same application pool account which we used for the SharePoint site because RunWithElevatedPrivileges takes the application pool account as an elevated account and run the following piece of code :-
1: SPSecurity.RunWithElevatedPrivileges(delegate()
2: {
3: using (SPSite site = new SPSite(tbox.Text))
4: {
5: using (SPWeb web = site.RootWeb)
6: {
7: if (!web.DoesUserHavePermissions(SPBasePermissions.Open))
8: {
9: name.Text = "YOU DOES NOT HAVE Permissions";
10: return;
11: }
12: name.Text = web.WebTemplate;
13: }
14: }
15: });