Last post Feb 03, 2012 02:35 PM by tpeczek
Feb 02, 2012 12:05 PM|dextar|LINK
I have a application page in asp.net in code behind i am using httpwebrequest to get the rss feed from a local source. The problen is rss feed is user specific for the logged in user in the application. but i am not able to pass the credentials for the logged
in user to the httpwebrequest.credentials object
I have tried using thedefaultnetworkcredentials but it gives the credentials for the applicationpoolaccount always so feed is coming for the wrong user. If i use new Networkcredentials("username",password, domain) and pass the details then i get the correct
result, but i can not ask the user to login again and give the password.
I have googled a lot found some ways like setting httpwebrequest properties using cookiecontainer and other properties all in vain.
Is there no way i can get the rss feed for the user.
Any help would be appreciated.
Thanks in advance
Feb 03, 2012 02:35 PM|tpeczek|LINK
The only solution here will be impersonation:
System.Security.Principal.WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentityUser.Identity).Impersonate();
//Here you can put the code for accessing RSS feed, DefaultNetworkCredentials should contain what you need
A little bit more reading about impersonation: