0

I am trying to open my app's Login Form whenever I try to double click and open any web browsers installed on my system. I have spent around a week without any success. Any help, articles, code or links would be of great help. Thanks.

I am using Visual Studio 2010 Programming Language : C#

Leri
  • 12,367
  • 7
  • 43
  • 60
Shadab
  • 15
  • 1
  • 6
  • 4
    can't you set your application login page as home page for browser !!! what c# will do in this case ?? – Rajeev Kumar Mar 12 '14 at 12:09
  • 1
    What are you trying to do? Open the default browser in order to display your webpage? – Marco de Abreu Mar 12 '14 at 12:10
  • 1
    You'll have to provide more info, errors, code... Now it's not clear what you're asking! – Abbas Mar 12 '14 at 12:10
  • 1
    I think you need to be more specific about what your problem is. If I read your post and take it literally it sounds like you just need to set your homepage on each browser to your apps login page... but im sure you dont mean that! – Fred Mar 12 '14 at 12:14
  • You need to explain what your *app* is. Is *app* a desktop application or a website? – Filburt Mar 12 '14 at 12:18
  • I am developing a parental control software which will allow a user to login and use internet. I also need to check the websites whether allowed to the user or not. I have done everything using the browser control in C#. Now i just wanted to use the system's browser instead. It is a desktop app – Shadab Mar 12 '14 at 12:24

2 Answers2

2

Trying to intercept every browser launch probably requires monitoring the system processes. I.e., your app will constantly be running and whenever a recognized browser process starts, you spawn your login form. There may be system events to hook into (I am not sure), but How can I list all processes running in Windows? might be a good starting point to get an idea what's possible.

A somewhat different approach would be to register your app as the system's default browser. That way, you will be notified, can spawn your LogIn form and can than delegate to an actual browser.

I am not sure what ultimate goal you pursue, and whether either is a good solution depends heavily on whether there are more constraints to it than you mention explicitly.

Community
  • 1
  • 1
Janis F
  • 2,637
  • 1
  • 25
  • 36
  • Yes Thank you.. and thanks to all other guys who replied.. :) – Shadab Mar 12 '14 at 12:21
  • also you can create a hook for that, take a look at [this](http://stackoverflow.com/questions/20620964/hooking-into-a-running-process-to-monitor-its-status) – tbc Mar 12 '14 at 12:24
0

In order to open a link with your default browser, use the following code.

System.Diagnostics.Process.Start("http://google.com");

You could compile your own Firefox-Version which contains a login form, but you would need a few more steps to prevent a user from launching a start-only browser like the TOR-Browser-Bundle.

Marco de Abreu
  • 663
  • 5
  • 17