The final goal I want is to get a request (eg: Pepe.aspx) and execute a C # method directly. I already achieved it but the HttpContext has the session in null (I know because it is in null)
In the global.asax I put:
protected void Application_BeginRequest(object sender, EventArgs e)
{
if (BaseApp.VirtualPageManager.ExecutePage())
{
CompleteRequest();
}
}
That function magically seeks and executes the method of this class:
public class TestPage: IVirtualPage
{
public static void Pepe()
{
//Do something..
Request;
Response;
HttpContext.Current.Session;
}
}
That works already, but session obviously is always null because I'm calling the function from the BeginRequest of the global.
Now if I take it out of the begin request and put:
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
if (BaseApp.VirtualPageManager.ExecutePage(Path.GetFileName(Request.PhysicalPath), Request, Response))
{
CompleteRequest();
}
}
But if I do this, you never get to run Application_AcquireRequestState because Pepe.aspx does not exist. That's why my idea was to find out how I can tell you in some way if it exists, process it, give me the session, and then I'll return a request.
Any ideas on how to have the session or councils on how to create a virtual page?