Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 785793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T20:56:09+00:00 2026-05-14T20:56:09+00:00

I have a URL and I want to launch it in the default browser.

  • 0

I have a URL and I want to launch it in the default browser. I’ve tried two methods:

Process.Start("http://stackoverflow.com");

… and the one detailed in this other question using ShellExecute.

In both cases I get the error: Windows cannot find ‘http://stackoverflow.com‘. Make sure you typed the name correctly, and then try again.

It shouldn’t be trying to open it as a file though… from what I understand, it should recognize it as a URL and open it in the default browser. What am I missing?

By the way: OS = Vista, and .NET = 3.5

EDIT:

According to this MS KB article, since Process.Start sets the UseShellExecute by default, it should launch the default browser.

EDIT:

Here’s what does work:

System.Diagnostics.Process.Start(@"C:\Program Files\Internet Explorer\IExplore.exe", "http://stackoverflow.com");

Unfortunately that really doesn’t launch the default browser, and it also doesn’t work if IE isn’t installed in the “normal” place. I’m not sure what to do here.

More information:

OK, so the error I’m getting is error number -2147467259. Looking at Google for this, it appears that it’s not very descriptive. It might be a file association error or something.

The plot thickens:

So I checked the registry key that’s supposed to have my file association for http:

KEY_CLASSES_ROOT\http\shell\open\command\default

Here’s the value:

"C:\Program Files\Mozilla Firefox\firefox.exe" -requestPending -osint -url "%1"

That makes sense. I actually copied this string into a command prompt and replaced the %1 with http://stackoverflow.com and it worked and opened firefox. I just don’t get why Process.Start isn’t associating the URL with this command…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T20:56:09+00:00Added an answer on May 14, 2026 at 8:56 pm

    Ok, so it mysteriously started working properly without changing anything. I can’t explain it. However, in the mean time, I wrote another method of finding and executing the default browser. It’s a little bit hacky, but much better than just loading IE by default:

    bool success = false;
    RegistryKey httpKey = Registry.ClassesRoot.OpenSubKey(@"http\shell\open\command");
    if (httpKey != null && httpKey.GetValue(string.Empty) != null)
    {
        string cmd = httpKey.GetValue(string.Empty) as string;
        if (cmd != null)
        {
            try
            {
                if (cmd.Length > 0)
                {
                    string[] splitStr;
                    string fileName;
                    string args;
                    if (cmd.Substring(0,1) == "\"")
                    {
                        splitStr = cmd.Split(new string[] { "\" " }, StringSplitOptions.None);
                        fileName = splitStr[0] + "\"";
                        args = cmd.Substring(splitStr[0].Length + 2);
                    }
                    else
                    {
                        splitStr = cmd.Split(new string[] { " " }, StringSplitOptions.None);
                        fileName = splitStr[0];
                        args = cmd.Substring(splitStr[0].Length + 1);
                    }
                    System.Diagnostics.Process.Start(fileName, args.Replace("%1","http://stackoverflow.com"));
                    success = true;
                }
            }
            catch (Exception)
            {
                success = false;
            }
        }
        httpKey.Close();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an url like this: http://www.w3schools.com/PHP/func_string_str_split.asp I want to split that url to
So I have an URL, let's say http://mysite-1.com/img.jpg and I want to acces that
If I have a URL (eg. http://www.foo.com/alink.pl?page=2 ), I want to determine if I
I have URL scheme for my blog like this: http://www.example.com/%YEAR%/%MONTH%/%CATEGORY%/%POST_TITLE%/ Now i want to
I have these two URL's I want to make available to my users: /Account/Orders
I have a URL in this format http://0.0.0.0:3000/#&ui-state=dialog . I want to check for
I have a URL string in the following format. http://myserver.com/_layouts/feed.aspx?xsl=4&web=%2F&page=dda3fd10-c776-4d69-8c55-2f1c74b343e2&wp=476f174a-82df-4611-a3df-e13255d97533 I want to replace
i have a image ,i want to launch url when i press that logo
I have read the answer How do I launch a URL in the browser
I have a URL like /admin/editblogentry?page=3&color=blue I want to alter the 'page' in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.