+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Issuing a WebRequest to a backend page

Issuing a WebRequest to a backend page

4 posts, 0 answered
  1. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    25 Mar 2014
    Link to this post

    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?

     

  2. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    28 Mar 2014
    Link to this post
    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();
    or by authenticating a user of your choosing using:
    SecurityManager.AuthenticateUser(UserManager.GetDefaultProviderName(), "UserName", "Password", false);


    Regards,
    Ivan D. Dimitrov
    Telerik
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
  3. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    28 Mar 2014 in reply to Ivan D. Dimitrov
    Link to this post

    Would that still work in the context of a ScheduledTask?

  4. Ivan D. Dimitrov
    Ivan D. Dimitrov avatar
    310 posts
    Registered:
    26 Mar 2015
    31 Mar 2014
    Link to this post
    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
     
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
     
4 posts, 0 answered