Issuing a WebRequest to a backend page
I need to be able to issue a WebRequest to get the responsestream from a backend SF page...
So the problem I'm having is that (clearly) it's responding back with the /Sitefinity login page html and not the ACTUAL backend page markup.
Do I have to log in as someone and pass that along with the request somehow?
Hi Steve,
You are on the right track. The WebRequest gets redirected to the login page due to the fact that there is no identity logged in. In order for it to pass its actual parameter, you will either need to get the currently logged user using:
ClaimsManager.GetCurrentIdentity();
SecurityManager.AuthenticateUser(UserManager.GetDefaultProviderName(),
"UserName"
,
"Password"
,
false
);
Would that still work in the context of a ScheduledTask?
Hi Steve,
In the case of a scheduled task I would advise the second method of doing this, as well as using a dummy user. This is done because you cannot ensure that the CurrentIdentity Auth cookie will not have expired by the time the task needs to trigger.
Regards,
Ivan D. Dimitrov
Telerik