0

I ran into a weird problem while using openid in asp.net. I wanted a server side logout for gmail account but without redirecting to another page. I thought executing a web request would do that. This is my code

    HttpWebRequest loHttp =
    (HttpWebRequest)WebRequest.Create("https://www.google.com/accounts/Logout");

    // *** Set properties
    loHttp.Timeout = 10000;     // 10 secs
    loHttp.UserAgent = "Code Sample Web Client";

    // *** Retrieve request info headers
    HttpWebResponse loWebResponse = (HttpWebResponse)loHttp.GetResponse();

    Encoding enc = Encoding.GetEncoding(1252);  // Windows default Code Page

    StreamReader loResponseStream =
       new StreamReader(loWebResponse.GetResponseStream(), enc);

    string lcHtml = loResponseStream.ReadToEnd();

    loWebResponse.Close();
    loResponseStream.Close();

But it doesn't seem to work. The gmail account is still signed in. Is it possible to execute a webrequest with such URL? Thanks

Paras
  • 2,997
  • 6
  • 35
  • 46

1 Answers1

2

I think that's because HttpWebRequest is made at the server level and you are logged in in the client.

You should use an iframe to load the URL

Alexandru Aliu
  • 474
  • 1
  • 4
  • 17