473,394 Members | 1,878 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Impersonation in code/Sharepoint

I've got a Sharepoint website for which the 'big guy' doesn't want to enable
impersonation.

But - I need impersonation for a file list (from another server), so I set
out to do it in code - - I found this on Support.MS.com:
http://support.microsoft.com/?id=306...23120121120120

I use the short portion, to impersonate the Authenticating User in Code.
This works for our regular dev web server, but apparently not in a
Sharepoint website (pointing to it in a Page View Web part)

Is there a way to create code to, instead of using the authenticated user,
use the ASPNet user account?
Jun 27 '08 #1
2 1080
On 20 May, 21:02, "Seth Williams" <s...@here.comwrote:
I've got a Sharepoint website for which the 'big guy' doesn't want to enable
impersonation.
...
Is there a way to create code to, instead of using the authenticated user,
use the ASPNet user account?
If impersonation is disabled then the ASP.NET user account will be
used anyway. However if the authentication mode is "Windows" then in
theory the authenticated Users privileges are merged with the ASP.NET
account (or so Microsoft tell us).

HTH
Jun 27 '08 #2
My code is below - anyway to change it to the ASPNet user?

Dim impersonationContext As
System.Security.Principal.WindowsImpersonationCont ext
Dim currentWindowsIdentity As System.Security.Principal.WindowsIdentity
currentWindowsIdentity = CType(User.Identity,
System.Security.Principal.WindowsIdentity)
impersonationContext = currentWindowsIdentity.Impersonate()

I've tried substituting it, in place of User.Identity, but that's not meant
for a string, so, of course, it doesn't work

"Stan" <go********@philhall.netwrote in message
news:be**********************************@8g2000hs e.googlegroups.com...
On 20 May, 21:02, "Seth Williams" <s...@here.comwrote:
>I've got a Sharepoint website for which the 'big guy' doesn't want to
enable
impersonation.
...
Is there a way to create code to, instead of using the authenticated
user,
use the ASPNet user account?

If impersonation is disabled then the ASP.NET user account will be
used anyway. However if the authentication mode is "Windows" then in
theory the authenticated Users privileges are merged with the ASP.NET
account (or so Microsoft tell us).

HTH

Jun 27 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ripa Horatiu | last post by:
Does anyone knows how can I impersonate to another user (basically Administrator) for a piece of my code? I've tried the samples provided by MS but they didn't worked. -- Horatiu Ripa
12
by: Anil Krishnamurthy | last post by:
We have an ASP.NET application that uses COM objects through Interop. The web application requires access to network and database resources and hence, needs to impersonate a domain account. The...
6
by: Michael S | last post by:
Not sure if I'm posting in the right group but here goes. I am getting the following error when trying to browse to an .aspx page which I have set up in a virtual directory under the default...
15
by: (PeteCresswell) | last post by:
Got a sample of MS's "Advisor Guide To Microsoft Access" in the mail today - accompanied by a sample "Advisor Guide To Microsoft SharePoint". I skimmed both, but the SharePoint explanation is too...
0
by: velvet.graham | last post by:
I'm having a difficult time with impersonation. I've created an impersonation class. Here is the code below: ******Impersonation Class Code********* Imports System Imports System.Web.Security...
8
by: GaryDean | last post by:
I was advised by a Microsoft speaker at a local .Net conference that "SharePoint" had a lot to offer for asp.net developers. I've spent a few hours hunting down links on Sharepoint Services in...
20
by: Neil | last post by:
What is Sharepoint, and should I care?
2
by: =?Utf-8?B?S2plbGw=?= | last post by:
Is this the tight place for Sharepoint issues? for example SharePoint Services 3.0 Kjell
0
by: ivandatasync | last post by:
I have read about both Plone and Alfresco being considered as alternatives to Sharepoint and unfortunately they may not be enough if you require everything Sharepoint has too offer. Plone and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.