Click here to Skip to main content
15,845,681 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
In a button event how do i redirect it to website when the button get clicks in windows application?
Posted
Updated 31-May-23 8:55am
Comments
Sergey Alexandrovich Kryukov 12-Jun-13 7:51am    
What's the problem? Redirect what? It depends on what you are using. System.Windows.Forms.WebBrowser? System.Windows.Controls.WebBrowser? Something else? It is of course possible (if I understand your question), but what's the problem?
—SA

C#
Process.Start("http://www.yourwebaddress.com");


Put that in the button click event. That will open your default web browser to the website, thats the only kind of "redirect" I know of from a windows forms application.
 
Share this answer
 
string strUrl = "http://google.com";
Process proc = new Process();
ProcessStartInfo startInfo = new ProcessStartInfo(strUrl);
proc.StartInfo = startInfo;
proc.Start();
 
Share this answer
 
That code returns with errors try System.Diagnostics.Process.Start(“https://google.com”);
 
Share this answer
 
Comments
Richard Deeming 1-Jun-23 6:14am    
Aside from the fact that you're 10 years too late, you're just repeating what the accepted solution already said.

The comment to that solution, posted almost six years ago, already mentioned using the fully-qualified name, for those who can't work out how to add a using System.Diagnostics; clause to their code (or let Visual Studio add it for them).

Stick to answering new questions unless you have something new and interesting to add to the discussion.

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