London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
AI OnAI Off
London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!
You cannot use HttpContext.Current when it runs automatically, cause you don't have one. You have to use another approach. A setting or something to choose which account to impersonate.
You can programmatically set the user by calling:
PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal("userName");
Hi Johan
PrincipalInfo.CurrentPrincipal = PrincipalInfo.CreatePrincipal("userName");
How to set it??? I mean if the username willbe of the system where we are running the application????? or we can add Active directory User????
In that case you can configure the schedular service to run under another account instead. See http://www.windowsecurity.com/articles/controlling-windows-services-service-accounts.html.
Hi,
I am using episerver Scheduled job when ever it runs automatically it throws exception "Object Refrence not set to an instance of an object". in my program i am using "(WindowsIdentity)HttpContext.Current.User.Identity;" any idea how to resolve this issue.
HttpWebRequest req = (HttpWebRequest)WebRequest.Create(uri);
req.UseDefaultCredentials = true;
to get an episerver page . please reply