Open Browser, Wait for Callback
-
Is it possible to open a browser with Process.Start("www.someplace.com") and wait for a callback? If so, what would that look like? I need to call Google People API in the default browser and wait for the redirect URL.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Is it possible to open a browser with Process.Start("www.someplace.com") and wait for a callback? If so, what would that look like? I need to call Google People API in the default browser and wait for the redirect URL.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
Callback? What callback? No. You're "fire and forget" launching a new process that runs independently from your code. There is no callback or notification of anything completing in the browser. You can call the Google API using an HttpClient and you'll have much greater control over the request and response process.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Callback? What callback? No. You're "fire and forget" launching a new process that runs independently from your code. There is no callback or notification of anything completing in the browser. You can call the Google API using an HttpClient and you'll have much greater control over the request and response process.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakYa, I was just hoping. Thanks anyhow
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Callback? What callback? No. You're "fire and forget" launching a new process that runs independently from your code. There is no callback or notification of anything completing in the browser. You can call the Google API using an HttpClient and you'll have much greater control over the request and response process.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakThis? [Window: DOMContentLoaded event - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded\_event)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
This? [Window: DOMContentLoaded event - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/DOMContentLoaded\_event)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
That fires inside the browser. It's not raised, or even exposed, to a separate process that launched the browser.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
That fires inside the browser. It's not raised, or even exposed, to a separate process that launched the browser.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakDoes the web browser / view control qualify? [WebBrowser.DocumentCompleted Event (System.Windows.Forms) | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.webbrowser.documentcompleted?view=windowsdesktop-7.0) [WebBrowser.LoadCompleted Event (System.Windows.Controls) | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.webbrowser.loadcompleted?view=windowsdesktop-7.0) [WebView.DOMContentLoaded Event (Windows.UI.Xaml.Controls) - Windows UWP applications | Microsoft Learn](https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview.domcontentloaded?view=winrt-22621)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
-
Does the web browser / view control qualify? [WebBrowser.DocumentCompleted Event (System.Windows.Forms) | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/api/system.windows.forms.webbrowser.documentcompleted?view=windowsdesktop-7.0) [WebBrowser.LoadCompleted Event (System.Windows.Controls) | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.webbrowser.loadcompleted?view=windowsdesktop-7.0) [WebView.DOMContentLoaded Event (Windows.UI.Xaml.Controls) - Windows UWP applications | Microsoft Learn](https://learn.microsoft.com/en-us/uwp/api/windows.ui.xaml.controls.webview.domcontentloaded?view=winrt-22621)
"Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I
You'd have to use the WebView2 control or the WebBrowser in your own app to get at the event. For one launched though the Process class, not so much. He never said why he's launching it through Process or anything else related to it so until he does, suggestion after suggestion is a moot point.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Is it possible to open a browser with Process.Start("www.someplace.com") and wait for a callback? If so, what would that look like? I need to call Google People API in the default browser and wait for the redirect URL.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
Rather than using a Web browser, you would be better interacting directly with the API. If you have to use the browser, you could always use a Web driver and Selenium. This should be of interest. How to automate web browser in C# - CODE-AI[^]
-
You'd have to use the WebView2 control or the WebBrowser in your own app to get at the event. For one launched though the Process class, not so much. He never said why he's launching it through Process or anything else related to it so until he does, suggestion after suggestion is a moot point.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave KreskowiakSorry I didn't clarify... I need to call Google's People API from a WPF app and wait for authentication. Once authentication is complete, then my app will get contact info. The requirement from Google is that the app not use an embedded browser, so I have to figure out if the user authenticated before continuing.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
-
Sorry I didn't clarify... I need to call Google's People API from a WPF app and wait for authentication. Once authentication is complete, then my app will get contact info. The requirement from Google is that the app not use an embedded browser, so I have to figure out if the user authenticated before continuing.
If it's not broken, fix it until it is. Everything makes sense in someone's mind. Ya can't fix stupid.
OK, so does the Google API have an alternate way to authenticate using credentials the user enters in your app instead of using the Google login page?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak