Click here to Skip to main content
15,920,468 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Is connection string must be changed after deployment ??? Pin
Ashish Sehajpal1-May-08 1:19
Ashish Sehajpal1-May-08 1:19 
AnswerRe: Is connection string must be changed after deployment ??? Pin
Tom Harper3-May-08 10:36
Tom Harper3-May-08 10:36 
GeneralRe: Is connection string must be changed after deployment ??? Pin
kindman_nb4-May-08 21:08
kindman_nb4-May-08 21:08 
QuestionHow to add dynamic coulmn in Gridview & its value.? Pin
GroCareer30-Apr-08 17:36
GroCareer30-Apr-08 17:36 
AnswerRe: How to add dynamic coulmn in Gridview & its value.? Pin
Christian Graus30-Apr-08 18:15
protectorChristian Graus30-Apr-08 18:15 
GeneralRe: How to add dynamic coulmn in Gridview & its value.? Pin
GroCareer30-Apr-08 18:19
GroCareer30-Apr-08 18:19 
GeneralRe: How to add dynamic coulmn in Gridview & its value.? Pin
Christian Graus30-Apr-08 18:41
protectorChristian Graus30-Apr-08 18:41 
AnswerRe: How to add dynamic coulmn in Gridview & its value.? Pin
Harini N K30-Apr-08 19:33
Harini N K30-Apr-08 19:33 
QuestionProblem in connection with sql server 2005 from vs2005 Pin
Dyuri30-Apr-08 17:22
Dyuri30-Apr-08 17:22 
AnswerRe: Problem in connection with sql server 2005 from vs2005 Pin
Christian Graus30-Apr-08 17:32
protectorChristian Graus30-Apr-08 17:32 
QuestionLearning ASP.Net Pin
jds120730-Apr-08 15:50
jds120730-Apr-08 15:50 
AnswerRe: Learning ASP.Net Pin
AlexeiXX330-Apr-08 16:19
AlexeiXX330-Apr-08 16:19 
AnswerRe: Learning ASP.Net Pin
Tad McClellan30-Apr-08 17:09
professionalTad McClellan30-Apr-08 17:09 
AnswerRe: Learning ASP.Net Pin
Christian Graus30-Apr-08 17:31
protectorChristian Graus30-Apr-08 17:31 
AnswerRe: Learning ASP.Net Pin
Vasudevan Deepak Kumar2-May-08 2:02
Vasudevan Deepak Kumar2-May-08 2:02 
QuestionAJAX server control not throwing events Pin
Tad McClellan30-Apr-08 12:38
professionalTad McClellan30-Apr-08 12:38 
QuestionCrystal Report Pin
sabaMCA30-Apr-08 10:52
sabaMCA30-Apr-08 10:52 
QuestionHow to catch page not found error when redirecting Pin
DotNetXenon30-Apr-08 8:42
DotNetXenon30-Apr-08 8:42 
AnswerRe: How to catch page not found error when redirecting Pin
Blue_Boy30-Apr-08 10:31
Blue_Boy30-Apr-08 10:31 
AnswerRe: How to catch page not found error when redirecting Pin
Sankar Komma 30-Apr-08 10:41
Sankar Komma 30-Apr-08 10:41 
Question[c#] read a table from a web page Pin
Joshua8230-Apr-08 8:22
Joshua8230-Apr-08 8:22 
AnswerRe: [c#] read a table from a web page Pin
Christian Graus30-Apr-08 10:51
protectorChristian Graus30-Apr-08 10:51 
AnswerRe: [c#] read a table from a web page Pin
Colin Angus Mackay30-Apr-08 13:56
Colin Angus Mackay30-Apr-08 13:56 
GeneralRe: [c#] read a table from a web page Pin
Joshua8230-Apr-08 22:41
Joshua8230-Apr-08 22:41 
Question403 Forbidden Error Due To Incorrect Impersonation Level? Pin
TGT30-Apr-08 6:23
TGT30-Apr-08 6:23 
I'm using HttpWebRequest and HttpWebResponse to query a remote server. I plan to load the returned xml into an XMLDocument, but the HttpWebRequest.GetResponse() method fails with a 403 "Forbidden" error.

I am able to get a response when I put my domain username and password as plain text into the request's Credentials member, but of course I'd like to avoid having that information in the application.

I thought that code along these lines (found at http://claytonj.wordpress.com/2006/09/04/run-code-under-the-iis-authenticated-user-context/)
would solve my problem:
using System.Security.Principal;

if (User.GetType() == typeof(WindowsPrincipal))
{
WindowsIdentity id = (WindowsIdentity) User.Identity;
WindowsImpersonationContext impersonate = id.Impersonate();


//perform tasks under the impersonated user
//*** ***//

//revert back to local ASPNET account
impersonate.Undo();
}
else
{
//user isn’t authenticated
}

But, I still get the 403 error. I think the impersonation is failing because the WindowsIdentity.ImpersonationLevel property is always "Impersonation." I think this needs to be "Delegation" to reach the remote server (I'm behind a firewall and corporate proxy), but the property is read-only so I can't set it.


My Question: What do I need to configure in order to get the ImpersonationLevel property to be of the TokenImpersonationLevel.Delegation type?

Let me know if this requires clarification.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.