Click here to Skip to main content
15,895,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear,

My question is, I have use one link button.When i click that button,it should open a browser.I need code for this issue. Kindly send for both c#.net windows and web applications.


Thanks& Regards,

Viswanathan.M
Posted
Updated 5-Jul-11 18:52pm
v2

string targetURL = @"http://pedroliska.com";
System.Diagnostics.Process.Start(targetURL);
 
Share this answer
 
v3
Comments
Viswanthan.M. 6-Jul-11 0:59am    
i need this in C# .net coding
Viswanthan.M. 6-Jul-11 1:20am    
Its working... thank you
[no name] 6-Jul-11 1:39am    
welcome
Sergey Alexandrovich Kryukov 6-Jul-11 1:31am    
This is correct answer, my 5. OP can formally accept it (I recommend it.)
However, please see my alternative solution -- in many cases it would be better.
--SA
[no name] 6-Jul-11 1:43am    
your solution is great. This will help us open the page on our window (including navigation). :)
Use Process.Start, and point to the URL you want to open, it will open it with the default browser. That's a windows app. In a web app, you just put a hyperlink, and put target="_blank", so the link opens in a new window.
 
Share this answer
 
Comments
Viswanthan.M. 6-Jul-11 0:53am    
Thanks for reply, but i need better
Viswanthan.M. 6-Jul-11 0:53am    
pls
Christian Graus 6-Jul-11 2:50am    
What do you mean 'better' ? Someone gave you the exact code, I see, but I told you exactly what you needed to do. If you could not understand me, I suggest you forget your current task and do a beginners course in C#.
Sergey Alexandrovich Kryukov 6-Jul-11 15:20pm    
Exactly, a 5.
--SA
All those runs of some applications are not good — the use knows better what to start and how. As you need to start certain URL, it's not that bad — you already have a correct answer by 2irfanshaikh.

But the real alternative would be running a browser inside your application. Just use the class System.Windows.Forms.WebBrowser, see http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx[^].

That was for System.Windows.Forms. There is such thing for WPF as well: System.Windows.Controls.WebBrowser, see http://msdn.microsoft.com/en-us/library/system.windows.controls.webbrowser.aspx[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900