10-03-2019 11:57 PM
10-03-2019 11:57 PM
We need to launch Edge (Chromium) using 'System.Diagnostics.Process' with header to target URL request.
My code is - Process.Start("microsoft-edge:" + <url>);
Which work and open the Edge with url argument.
How can I pass a request header to the url.
10-04-2019 01:05 PM
@Kamal1315 In general, you should avoid launching a user's browser using a protocol handler wrapper (like "microsoft-edge:") and should instead just pass the URL (e.g. "https://www.foo/"). This will ensure that the user's default browser opens and handles the link. The default browser is more likely to work correctly vs a browser that is not their default (which might not have correct proxy settings, extensions, VPN, account info, etc).
To the other part of your question, no, there's no standard for opening a browser and passing headers or POST body information as a part of the initial request. There are ways to do this in certain browsers (e.g. Internet Explorer using COM invocation) but no reliable cross-browser standard. Instead, there are two possible routes:
1. Write a local HTML file that contains a form that automatically submits the desired data to the target server. This will allow sending of POST requests, etc.
2. Write a remote HTML file (e.g. on your server) that contains a form that automatically submits the desired data to the target server. This will allow sending of POST requests, etc.
Neither of these approaches is likely to allow you to pass a header to the target, insofar as there's no standard way in the web platform to "Navigate with header". That restriction exists mostly for security reasons.
What header do you need to pass, to what service or server? Do you control the service/server? Must the data be in a header vs. a POST body or Query Parameter on the URL?
10-06-2019 11:38 PM - edited 10-06-2019 11:41 PM
@ericlawThanks Eric for reply.
Please see my comments for your query -
[What header do you need to pass, to what service or server? Do you control the service/server? Must the data be in a header vs. a POST body or Query Parameter on the URL?]
=> We need to pass authentication header to our own server's hosted web application.
Authentication details are normally sent via header only, so no post body or query string parameter.
10-07-2019 07:59 AM