Win Surprise Gifts!!!
Top 5 Contributors of the Month
Post New Question
Subscribe to Interview Questions
How Do you implement Impersonation in ShrePoint.
Posted By :
Posted Date :
October 31, 2011
Ans. By Using RunWithElevatedPrivileges method provided by SPSecurity class.
See e.g Impersonation in Sharepoint
You can also find related Interview Question to
How Do you implement Impersonation in ShrePoint.
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.
SPSite mySite = SPContext.Current.Site;
SPWeb myWeb = mySite.OpenWeb();
// 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;
web.AllowUnsafeUpdates = false;
//siteCollection = null;
//web = null;
How can Impersonation be implemented in ShrePoint?
Impersonation can be implemented By Using RunWithElevatedPrivileges method provided by SPSecurity class in SharePoint.
If you are using C language to implement the heterogeneous linked list, what pointer type will you use?
The heterogeneous linked list contains different data types in its nodes and we need a link, pointer to connect them. It is not possible to use ordinary pointers for this. So we go for void pointer. Void pointer is capable of storing pointer to any type as it is a generic pointer type.
Minimum number of queues needed to implement the priority queue?
Two. One queue is used for actual storing of data and another for storing priorities.
How do you implement thread synchronization (Object.Wait, Notify,and CriticalSection) in C#?
You want the lock statement, which is the same as Monitor Enter/Exit:
set Timedout("alert('5 seconds')",5000); Here the argument 5000 shows the millisecond value.
How would you implement inheritance using VB.NET/C#?
When we set out to implement a class using inheritance, we must first start with an existing class from which we will derive our new subclass. This existing class, or base class, may be part of the .NET system class library framework, it may be part of some other application or .NET assembly, or we may create it as part of our existing application. Once we have a base class, we can then implement one or more subclasses based on that base class. Each of our subclasses will automatically have all of the methods, properties, and events of that base class ? including the implementation behind each method, property, and event. Our subclass can add new methods, properties, and events of its own - extending the original interface with new functionality. Additionally, a subclass can replace the methods and properties of the base class with its own new implementation - effectively overriding the original behavior and replacing it with new behaviors. Essentially inheritance is a way of merging functionality from an existing class into our new subclass. Inheritance also defines rules for how these methods, properties, and events can be merged.
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.
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.
suppose two interfaces have same method, so how will you implement these methods in derive class?
by using interface name
Is dotnet frameword needed to implement silverlight?
No, It's a cross platform version of the .NET Framework which is included in the 6 MB Silverlight 4 download, so you do not need to have anything extra to be installed on the client in order to access Silverlight applications in the browser.
How can we implement update progress in weplication?
The following code shows how to create Progress Bar Using AJAX.
There is an UpdatePanel , which has a Button into it. And Place an UpdateProgress which perform the defined progress for the action happens inside the UpdatePanel by any of the controls within it.
Since i have an UpdateProgress within the UpdatePanel, and have set the AssociatedUpdatePanelID="UpdatePanel1". The UpdateProgress has the "gif" image which looks like a progress.
Place a gif image of a progress bar and impletement the same thing for showing the progress to the user.
Please find the attachments if you are not able to see the design.
" height="12" alt=""/>
Can we implement Multiple Inheritance by using Abstract Class?
As the abstarct class can contain simple methods also, therefore it doesn't support Multiple Inheritance in DotNet.
You have got 1 million parking slots. At a time a parking slot can be free or not. To get next slot easily which data structure to implement?
If you use Stack, we can just get the next slot by using stack.Pop()
If you use List, we have to iterate through all list and check the status and retrieve.
So stack would be advantageous.
Quick Links For Interview Questions Categories:
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
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
Terms of Service
Tell A Friend