Search code examples
c#asp.netasp.net-mvcasp.net-mvc-4application-variables

What is the equivalent of Page.Application (in .aspx.cs page) In MVC Controller


I am working on MVC web application, and I am using .Dlls. of some other project. That same .dll is also using in my another Web Application which is made in WebForms (.aspx) pages.

Now my question is: some function from that .dll are accepting Page.Application as a parameter. Which is working fine in .aspx page. BUT now I want to use same function in MVC application. But in MVC controller I am not able to access that Page.Application

So Please someone can help me That How can I access Page.Application in MVC Controller and Is there any equivalent of Page.Application in MVC Controller

Thanks,

EDIT:- I am not asking about Application variable - I am asking about Page.Application which is object of HttpApplicationState . I want this HttpApplicationState in MVC Controller


Solution

  • In mvc, there is no page lifecycle as in webform. Every thing from routing machanism.

    While page.application, it is gets the HttpApplicationState object for the current Web request.

    From MVC3 it support HttpApplicationState variable in mvc.

    Check this answer :

    HttpApplicationState not available in an MVC controller

    Does asp.net MVC have Application variables?