Chepene
Chepene

Reputation: 1128

Open url in browser and fill asp.net popup with values from wpf application

I have a Wpf application and I want to open url (asp page) and fill popup with values (login, password). How can I do it?

Now I open url with Process.Start:

var processStartInfo = new ProcessStartInfo(url);
Process.Start(processStartInfo);

But I can't find out a way to fill popup..

I find way to use webControl... but I need to open url in browser..

Upvotes: 0

Views: 376

Answers (1)

Markus
Markus

Reputation: 22501

My first recommendation is to think whether a mechanism like this is really necessary because it deals with a lot of sensitive Information. If you can avoid it, I'd recommend not to use at least the password. Can you make changes to the ASP-page? Then you can add some request parameters that the ASP application fills into the fields, you could do that.
However, in this specific scenario I strongly recommend NOT to fill the username and password directly in the URL because it can be read easily along the path. If the application runs in a completely safe, controlled area, one can argue about the username, but I would not recommend it.
What you could do is to create some kind of token mechanism, so that you do not transmit sensitive data:

  1. WPF application creates token, e.g. in database. It is important that the token is random and cannot be guessed, maybe a GUID. Also it should be valid only for a short period of time. Also the WPF application stores the necessary login Information in the database.
  2. WPF application opens the browser with an URL like https://srv?token=<random token>.
  3. ASP application receives token through request Parameter, checks whether it is still valid and signs user in using the Information that is stored along with the token. It deletes the entry in the database immediately so that the token cannot be reused.

This approach requires you to be able to make changes to both the WPF application and also the ASP application. And as said above, if you can avoid it, it is preferrable to have the user enter his or her credentials manually.

Upvotes: 1

Related Questions