Opening a URL containing a query string
I need to be able to open a link in a browser from a C# application. Normally, I would use a code like this to open the link:
Process.Start(new ProcessStartInfo("explorer.exe", @"http://www.google.com"));
Unfortunately, that only succeeds in opening explorer and not a browser when the URL contains a query string such as:
http://www.google.com/search?q=stackoverflow
How can I open URLs with query strings?
Edit Notes: I am using Windows 8 with non-IE default browsers. I am seeing the same error with 'Class Not Registered' when trying to use just Process.Start as described here: Process.Start(url) broken on Windows 8/Chrome - are there alternatives?
c# windows-8 query-string
add a comment |
I need to be able to open a link in a browser from a C# application. Normally, I would use a code like this to open the link:
Process.Start(new ProcessStartInfo("explorer.exe", @"http://www.google.com"));
Unfortunately, that only succeeds in opening explorer and not a browser when the URL contains a query string such as:
http://www.google.com/search?q=stackoverflow
How can I open URLs with query strings?
Edit Notes: I am using Windows 8 with non-IE default browsers. I am seeing the same error with 'Class Not Registered' when trying to use just Process.Start as described here: Process.Start(url) broken on Windows 8/Chrome - are there alternatives?
c# windows-8 query-string
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04
add a comment |
I need to be able to open a link in a browser from a C# application. Normally, I would use a code like this to open the link:
Process.Start(new ProcessStartInfo("explorer.exe", @"http://www.google.com"));
Unfortunately, that only succeeds in opening explorer and not a browser when the URL contains a query string such as:
http://www.google.com/search?q=stackoverflow
How can I open URLs with query strings?
Edit Notes: I am using Windows 8 with non-IE default browsers. I am seeing the same error with 'Class Not Registered' when trying to use just Process.Start as described here: Process.Start(url) broken on Windows 8/Chrome - are there alternatives?
c# windows-8 query-string
I need to be able to open a link in a browser from a C# application. Normally, I would use a code like this to open the link:
Process.Start(new ProcessStartInfo("explorer.exe", @"http://www.google.com"));
Unfortunately, that only succeeds in opening explorer and not a browser when the URL contains a query string such as:
http://www.google.com/search?q=stackoverflow
How can I open URLs with query strings?
Edit Notes: I am using Windows 8 with non-IE default browsers. I am seeing the same error with 'Class Not Registered' when trying to use just Process.Start as described here: Process.Start(url) broken on Windows 8/Chrome - are there alternatives?
c# windows-8 query-string
c# windows-8 query-string
edited Jan 2 at 2:27
Cœur
18.5k9110148
18.5k9110148
asked Jan 29 '13 at 14:53
cvocvocvocvo
84711333
84711333
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04
add a comment |
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04
add a comment |
4 Answers
4
active
oldest
votes
Finally found a solution -- kind of impressed I didn't try this to begin with after writing batch files years ago this was common.
Process.Start(new ProcessStartInfo("explorer.exe", """ + @"http://www.google.com/search?q=stackoverflow" + """));
Just adding quotes around it seems to work fine.
add a comment |
You can use the default browser with :
Process.Start(@"http://www.google.com");
Simple isn't it?
And it works with query strings:
Process.Start(@"http://www.google.com/search?q=stackoverflow");
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
add a comment |
You just neet do do this:
try
{
Process.Start(@"http://www.google.com/search?q=stackoverflow");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
add a comment |
Try "start" instead of "explorer.exe". Pulling up the command line and typing < start http://google.com?q=blah > worked for me.
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14585709%2fopening-a-url-containing-a-query-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
Finally found a solution -- kind of impressed I didn't try this to begin with after writing batch files years ago this was common.
Process.Start(new ProcessStartInfo("explorer.exe", """ + @"http://www.google.com/search?q=stackoverflow" + """));
Just adding quotes around it seems to work fine.
add a comment |
Finally found a solution -- kind of impressed I didn't try this to begin with after writing batch files years ago this was common.
Process.Start(new ProcessStartInfo("explorer.exe", """ + @"http://www.google.com/search?q=stackoverflow" + """));
Just adding quotes around it seems to work fine.
add a comment |
Finally found a solution -- kind of impressed I didn't try this to begin with after writing batch files years ago this was common.
Process.Start(new ProcessStartInfo("explorer.exe", """ + @"http://www.google.com/search?q=stackoverflow" + """));
Just adding quotes around it seems to work fine.
Finally found a solution -- kind of impressed I didn't try this to begin with after writing batch files years ago this was common.
Process.Start(new ProcessStartInfo("explorer.exe", """ + @"http://www.google.com/search?q=stackoverflow" + """));
Just adding quotes around it seems to work fine.
answered Jan 29 '13 at 15:16
cvocvocvocvo
84711333
84711333
add a comment |
add a comment |
You can use the default browser with :
Process.Start(@"http://www.google.com");
Simple isn't it?
And it works with query strings:
Process.Start(@"http://www.google.com/search?q=stackoverflow");
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
add a comment |
You can use the default browser with :
Process.Start(@"http://www.google.com");
Simple isn't it?
And it works with query strings:
Process.Start(@"http://www.google.com/search?q=stackoverflow");
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
add a comment |
You can use the default browser with :
Process.Start(@"http://www.google.com");
Simple isn't it?
And it works with query strings:
Process.Start(@"http://www.google.com/search?q=stackoverflow");
You can use the default browser with :
Process.Start(@"http://www.google.com");
Simple isn't it?
And it works with query strings:
Process.Start(@"http://www.google.com/search?q=stackoverflow");
answered Jan 29 '13 at 14:54
Cédric BignonCédric Bignon
10.4k13148
10.4k13148
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
add a comment |
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
Doing this gives me a "Class Not Registered" exception: at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start()rn at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)rn at System.Diagnostics.Process.Start(String fileName)rn at QueryStringLaunch.Form1.button1_Click(Object sender, EventArgs e) in D:\Documents\Visual Studio 2010\TestProjects\QueryStringLaunch\QueryStringLaunch\Form1.cs:line 24" string
– cvocvo
Jan 29 '13 at 15:01
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
That class not registered error points to this issue: stackoverflow.com/questions/12206368/…
– cvocvo
Jan 29 '13 at 15:02
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Yes I am using Windows 8 x64
– cvocvo
Jan 29 '13 at 15:05
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
Ideally that'd be the case but unfortunately over thousands of users I can't expect them to do this.
– cvocvo
Jan 29 '13 at 15:07
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
@cvocvo Here you may find the solution to register correctly your browser. Hope it helps.
– Cédric Bignon
Jan 29 '13 at 15:09
add a comment |
You just neet do do this:
try
{
Process.Start(@"http://www.google.com/search?q=stackoverflow");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
add a comment |
You just neet do do this:
try
{
Process.Start(@"http://www.google.com/search?q=stackoverflow");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
add a comment |
You just neet do do this:
try
{
Process.Start(@"http://www.google.com/search?q=stackoverflow");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
You just neet do do this:
try
{
Process.Start(@"http://www.google.com/search?q=stackoverflow");
}
catch(Exception ex)
{
MessageBox.Show(ex.ToString());
}
answered Jan 29 '13 at 14:56
codeteqcodeteq
1,06058
1,06058
add a comment |
add a comment |
Try "start" instead of "explorer.exe". Pulling up the command line and typing < start http://google.com?q=blah > worked for me.
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
add a comment |
Try "start" instead of "explorer.exe". Pulling up the command line and typing < start http://google.com?q=blah > worked for me.
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
add a comment |
Try "start" instead of "explorer.exe". Pulling up the command line and typing < start http://google.com?q=blah > worked for me.
Try "start" instead of "explorer.exe". Pulling up the command line and typing < start http://google.com?q=blah > worked for me.
edited Jan 29 '13 at 15:24
answered Jan 29 '13 at 14:56
Louis RicciLouis Ricci
16.7k43557
16.7k43557
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
add a comment |
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
I got a "System cannot find the file specified" error
– cvocvo
Jan 29 '13 at 15:06
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
@cvocvo - SO remove the <start from the beginning thinking it was an html tag.
– Louis Ricci
Jan 29 '13 at 15:25
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f14585709%2fopening-a-url-containing-a-query-string%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
What happens when you include a query string?
– Ash Burlaczenko
Jan 29 '13 at 14:54
I have a class not registered exception -- this situation going on: stackoverflow.com/questions/12206368/… I AM running Windows 8 with Chrome as default browser. My code needs to work with ANY default browser.
– cvocvo
Jan 29 '13 at 15:04