.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> SharePoint >> Post New Question Subscribe to Interview Questions

What is impersonation, and when would you use impersonation?

Posted By :abhays     Posted Date :June 05, 2014    Points :40   Category :SharePoint 
Impersonation provides the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn't be able to access or execute something.

You can also find related Interview Question to What is impersonation, and when would you use impersonation?  below: 

what is Impersonation?

  
Another important security feature is the ability to control the identity under which code is executed.
Impersonation is when ASP.NET executes code in the context of an authenticated and authorized client.
By default, ASP.NET does not use impersonation and instead executes all code using the same user account as the ASP.NET process, which is typically the ASPNET account.
This is contrary to the default behavior of ASP, which uses impersonation by default. In Internet Information Services (IIS) 6, the default identity is the NetworkService account.
(More...)

What is impersonation, and when would you use impersonation?

  
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn't be able to access or execute something.
(More...)

How Do you implement Impersonation in ShrePoint.

  
Ans. By Using RunWithElevatedPrivileges method provided by SPSecurity class.
See e.g Impersonation in Sharepoint (More...)

What is impersonation, and when would you use impersonation?

  

Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn't be able to access or execute something. (More...)

How can Impersonation be implemented in ShrePoint?

  
Impersonation can be implemented By Using RunWithElevatedPrivileges method provided by SPSecurity class in SharePoint. (More...)

What is impersonation, and when would you use impersonation?

  
Impersonation can basically provide the functionality of executing something in the context of a different identity, for example assigning an account to users with anonymous access. You would use impersonation in order to access resources on behalf of the user with a different account, that normally, that wouldn't be able to access or execute something.

(More...)

How will you implement Impersonation in ShrePoint.

  
By Using RunWithElevatedPrivileges method provided by SPSecurity class.
The SPSecurity class provides a method (RunWithElevatedPrivileges) that allows you to run a subset of code in the context of an account with higher privileges than the current user.
The premise is that you wrap the RunWithElevatedPrivileges method around your code. And also In certain circumstances, such as when working with Web forms, you may also need to set the AllowSafeUpdates method to true to temporarily turn off security validation within your code. If you use this technique, it is imperative that you set the AllowSafeUpdates method back to false to avoid any potential security risks.
Code example
{
SPSite mySite = SPContext.Current.Site;
SPWeb myWeb = mySite.OpenWeb();
//Using RunWithElevatedPrivileges
SPSecurity.RunWithElevatedPrivileges(delegate()
{
// Get references to the site collection and site for the current context.
// The using statement makes sures these references are disposed properly.
using (SPSite siteCollection = new SPSite(mySite.ID))
{
using (SPWeb web = siteCollection.OpenWeb(myWeb.ID))
{
web.AllowUnsafeUpdates = true;
try
{
//Your code
}
web.AllowUnsafeUpdates = false;
//siteCollection = null;
//web = null;
} (More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend