Feedback
 
Did this article resolve your question/issue?

   

Your feedback is appreciated.

Please tell us how we can make this article more useful. Please provide us a way to contact you, should we need clarification on the feedback provided or if you need further assistance.

Characters Remaining: 1025

 


Article

How to distinguish a backend from a frontend request using API

« Go Back

Information

 
Article Number000098362
EnvironmentProduct: Sitefinity
Version: 5.x, 6.x, 7.x, 8.x, 9.x, 10.x, 11.x, 12.x
OS: All supported OS versions
Database: All supported Microsoft SQL Server versions
Question/Problem Description
How to differentiate a frontend from a backend request using API?
Steps to Reproduce
Clarifying Information
Error Message
Defect/Enhancement Number
Cause
Resolution
Generally, the most reliable way to differentiate between a frontend and backend request is to check the request's URL and see if the /Sitefinity parameter is present. This parameter indicates that the request is a backend one. Sample code would be:
if(HttpContext.Current.Request.Url.ToString().Contains("/Sitefinity"))
{
    //you are working with backend request
}
else
{
    //you are working with frontend request
}

There might be exceptions, depending on the Sitefinity version used. For example, service calls to the /sf/system and the /restapi routes. Place the necessary checks where applicable.
 
Workaround
Notes
Attachment 
Last Modified Date9/11/2019 12:42 PM