How to open URL in browser in C# ?

When you work in C# Desktop App You can simply call this code to open the link in the browser

System.Diagnostics.Process.Start(“http://rnivedita.com”);

In case of .Net core Console application you need to use this code

System.Diagnostics.Process.Start(“cmd”, “/C start http://rnivedita.com”);

The above solution is working for Desktop app, What if I have ASP.NET MVC or Web apps.

When you work in a web-application you use some kind of redirect in the backend to redirect the page to the following URL

for Example, if you are in ASP.NET MVC You can some kind of Redirect.

return Redirect(“http://rnivedita.com”);

return RedirectPermanent(“http://rnivedita.com”);

These 2 Redirects are the example of redirecting the URL, First one is simple redirect and second one is permanent Redirect.

If you are trying to use Permanent Redirect and change it to some other domain you will see it still redirects to the old URL you use.

Browser cache the Permanent Redirect, Later it doesn’t hit the server it simply redirects it to the given URL itself. Permanent Redirect used for telling Search Engine that the URL is changed to new one.

This is my first post here. I just Shree Ganesh (Launched) my website. I know this is the very weird article.

Thanks for reading my article.

Leave a Reply

Your email address will not be published. Required fields are marked *