Click here to Skip to main content
15,899,314 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,

I am doing windows application and trying to get information whenever computer user use http / https to request any information from internet. I am trying to get information requested url by computer user from http or https (for any type of browser)
Posted

1 solution

You can do it by checking the url scheme, using the Request.Url.Scheme.

C#
public void Init(HttpApplication application)
{
    application.BeginRequest += new EventHandler(application_BeginRequest);
}

protected void application_BeginRequest(object sender, EventArgs e)
{
    HttpApplication application = ((HttpApplication)(sender));
    HttpRequest request = application.Request;

    if (request.Url.Schema == "http://" || "https://")
    {
         Response.Redirect(request.Url);
    }

}
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900