Michael
Michael

Reputation: 13636

How to close web page using c#?

I create popoup window:

window.open(msg,'LoginPopup');

After popup window implemnet a Get request to this function in the server:

public void GmailOAuthCallback(string code)
{
    object contacts = GmailServiceWorkflow.GetContacts(code);
} 

I want to close the window.

Any idea how can I close the popup window whithin GmailOAuthCallback function?

Upvotes: 0

Views: 609

Answers (1)

Justin Skiles
Justin Skiles

Reputation: 9523

You will need to close the window through JavaScript. C# has no control over the browser. But, as a security feature, it's difficult to close a window from code. Read more here: window.close and self.close do not close the window in Chrome

Upvotes: 2

Related Questions