We sometimes want custom application pages in SharePoint solution , which needs to be enabled for anonymous access, for example: SiteLogin.aspx or AppError.aspx. By default, when we create an custom application page in visual studio in a SharePoint 2010 solution, it inherits from Microsoft.SharePoint.WebControls.LayoutsBasePage . so by default this custom application page needs login
To make an application page anonymous, just Inherit from Microsoft.SharePoint.WebControls.UnsecuredLayoutsPageBase & override AllowAnonymousAccess() property to return true;
While deploying SharePoint 2010 solution from Visual Studio 2010, we often stumble upon the below deployment error:
Recycle IIS Application Pool’: <nativehr>0x80070005</nativehr><nativestack></nativestack>Access denied
Solution: The Deploy Solution user that is running the visual Studio needs to be site collection Admin on the site , in my case, its Domain\Administrator
Active Directory user schema has enough properties/attributes to cover most user profile information, but in some cases , we might need to extend this schema to add our own custom attributes. Microsoft Active Directory provides this capability to customize the user schema at various domain/forest hierarchy levels. The below article was tremendously helpful for us to achieve this. Thanks a lot Kurt Hudson.
Unique X.500 Object Id: is an unique object identifier for an attribute. This is NOT auto-generated when extending user schema, we need to come up with one or use this script to generate one. For more information, please check Obtaining an Object Identifier from Microsoft
We all know the below way to get the current logged in user in SharePoint:
SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser;
but this actually returns the user account running the application pool identity for that site.(if the application pool is configured to run as a standalone/service user account))
Another way to get the current context logged in user is through ensuring the login name:
SPWeb web = SPContext.Current.Web;
string loginName = System.Threading.Thread.CurrentPrincipal.Identity.Name
SPUser user = web.EnsureUser(@"i:" + loginName ); // Had to Append "i:" in my case of Custom Authentication Providers
For more information, please check out SPWeb.EnsureUser
Once we have current SPUser Object, we can also get to his SP Security Groups :
SPUser user = web.EnsureUser(@"i:" + loginName );
SPGroupCollection userGroups = user.Groups;
foreach (SPGroup spgroup in userGroups)
While deploying SSRS (SQL Server Reporting services) in SharePoint Integration mode, the deployment Path URL’s must be absolute (this includes http://, the site collection, the path to the site,the library,). For example :
TargetServerURL – indicates which site to deploy the report. In the above example, I deployed it to a Sub-site ‘Reports’. We can even deploy it at site collection level. i.e http://dev:3660
TargetDataSourceFolder – A regular SharePoint data connection library to store & may be share the data source used by the report.
TargetReportFolder – A regular SharePoint library to save the report.
During deployment via Business Intelligence Visual Studio, it may ask for appropriate account privileges. Successful Output below : ——————————————————————————————————————————–
Deploying to http://dev:3660/Reports
Deploying data source ‘http://dev:3660/reports/ReportsDataSource/AWDataSource.rsds’.
Deploying report ‘http://dev:3660/reports/AWReports/AWVendors.rdl’.
Deploy complete — 0 errors, 0 warnings
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
========== Deploy: 1 succeeded, 0 failed, 0 skipped ==========
Sometimes we may need to find assembly files (.dll) in the Microsoft windows GAC (Global Assembly Cache), while working in the world of Microsoft.NET. The default GAC folder is located at C:\Windows\assembly, but looking in this directory , we would only find the installed versions of these assemblies.
To find the actual .dll file of these installed assemblies, just
Open Dos-Prompt & type dir fullname of the assembly followed by ‘/s‘. For example
C:\>dir Microsoft.SharePoint.IdentityModel.dll /s
Once you find the dll file, copy it to your project & enjoy coding…
I was trying to read a property value from the user schema of an Active Directory, the mystery is that the value data type sometimes comes as byte & sometimes as String. As much as I do not like it, I have to rely on the type for further processing..
System.Type type = objectTemp.GetType();
if (type == typeof(String))
if (type == typeof(byte))