THE EXPERIENCED

Software Engineer - Back-End Developer / Front-End Developer

ASP.NET – Execute a load event handler from another page

One of the many ways is to use the HttpWebRequest/Response classes:

VB.NET:

Dim MainPageUrl As String = "http://localhost:1234/anotherpage.aspx";
Dim request As HttpWebRequest = DirectCast(WebRequest.Create(MainPageUrl), HttpWebRequest);
Dim response As HttpWebResponse = DirectCast(request.GetResponse(), HttpWebResponse);
C#.NET:

String MainPageUrl = "http://localhost:1234/anotherpage.aspx";
HttpWebRequest request = ( HttpWebRequest) WebRequest.Create(MainPageUrl);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Then whatever it’s inside the anotherpage.aspx load event will be executed. Voila!.