Intercepting Http request for SSL certificate

Is there a way to intercept the call made by WebBrowser on SSL (inside asp.net app)? I need to pass parameters to http headers at runtime before the request is made.

Example : If I find " http://test.com , the browser communicates with the server and returns" https://test1.com "as the secure url. I should be able to intercept the call and pass the headgear information ( key, value defining the original host) at http://test.com Or is there a better solution to achieve this?

Thanks in advance

0


a source to share


1 answer


I do the following to force users to use HTTPS:

protected override void OnPreInit(EventArgs e)
{
    if (string.Compare(Request.ServerVariables["HTTPS"], "OFF", true) == 0)
    {
        StringBuilder builder = new StringBuilder("https://");
        builder.Append(Request.ServerVariables["SERVER_NAME"]);
        builder.Append(Request.ServerVariables["URL"]);
        Response.Redirect(builder.ToString());
        return;
    }

    base.OnPreInit(e);
}

      



You should be able to change it to do what you want it to do.

0


a source







All Articles