2009-06-29

Elevated Privliges, Kerberos, NTLM, Pool Account Identity, Impersonation, etc

Here are some code snippets that I frequently use to run code with extra privliges, access resources using WebRequest, etc.:

// Accessing resource files using Pool Account credentials, for example,
// to avoid 401 Unatohorized Access messages in production
using (HostingEnvironment.Impersonate())
{
WebRequest req = WebRequest.Create("url to my xsl file");
StreamReader reader = new StreamReader(req.GetResponse().GetResponseStream(),
System.Text.Encoding.UTF8);


...
}


// To run code with eleavted privligies:

2009-06-16

403 Forbidden when trying to insert a document or link - hitting the Browser button (AssetPortalBrowser.aspx)

You (or you or your users) will (sooner or later) encounter a "403 Forbidden" error when hitting the Browse button in the AssetPortalBrowser dialog. The reason for this is (most likely) that the previous url location addressed (i.e. browsed to) in the dialog is either moved or you (or your user) no longer has access to it.

Thanx to Steven that had identified the cause and how to fix it. Read more here ...

Therefore: Be aware of possible problems after you have restructured your site ....