Asp.net mvc partials do they know that they work offline or as part of a page

Does anyone know if the partial view ( PartialViewResult) in the ascx file - knows if it works autonomously - is called directly from the browser or as part of the page.

I would like to consider these cases in different ways.

Edit:
Case 1:
In the case of a page, it may be that there are several partial files on the page that are loaded using ajax during page creation. Partial can be called again using ajax in accordance with user actions. In this case, I consider them as controls on the page.

Case 2: In a particular case, a part may be called as part of a test directly from the browser. In this case, you see only a partial part in the browser.

Case 3: In the third case, the partial can be called as part of the iframe in the google chrome extension (for example). In this case, you can see a partial on a page that would not be built in your web application.

Hope this makes sense.

Thanks in advance to those who are concerned - happy new year.

+1
source share
1 answer

You can distinguish between normal and ajax ( Request.IsAjaxRequest()) and child actions ( ControllerContext.IsChildAction- are displayed using Html.Action).

, , , - , , , Html.RenderPartial, .

+3

Source: https://habr.com/ru/post/1782645/


All Articles