|
|
Error trying to open web page using System.Diagnostics.Process.Start |
|
Author |
Message |
CraigTin

|
Posted: Thu Jan 06 12:28:40 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
I have the follwong code:
private void ButtonOpen_Click(object sender, System.EventArgs e)
{
System.Diagnostics.Process.Start(" http://www.hide-link.com/ ");
}
which results in the following exception:
'An attempt was made to reference a token that does not exist '
What am I doing wrong? I'm not sure of the exact meaning of this error.
Thanks
Wade
DotNet139
|
|
|
|
 |
wadefleming

|
Posted: Thu Jan 06 12:28:40 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Following up on this if I try
System.Diagnostics.Process.Start("notepad.exe");
I get no error, but notepad does not start either. I have also tried
using the full path name.
|
|
|
|
 |
wadefleming

|
Posted: Thu Jan 06 12:30:00 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Following up on this if I try
System.Diagnostics.Process.Start("notepad.exe");
I get no error, but notepad does not start either. I have also tried
using the full path name.
|
|
|
|
 |
Cor

|
Posted: Thu Jan 06 12:59:55 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Wade,
This can much shorter however to show you a full version.
\\\
System.Diagnostics.Process p =
new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo pi =
new System.Diagnostics.ProcessStartInfo();
pi.FileName = "http://www.google.com";
p.StartInfo = pi;
p.Start();
///
I hope this helps?
Cor
|
|
|
|
 |
wadefleming

|
Posted: Fri Jan 07 07:05:53 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Thanks for the reply, but I am still getting similar results. That is,
when trying to execute "notepad.exe" I get no exception, in fact
p.Start() returns true, however notepad does not start.
When setting the filename to "http://www.google.com", I get the same
error as before, 'An attempt was made to reference a token that does
not exist ', on the line p.Start()
Any ideas?
|
|
|
|
 |
Cor

|
Posted: Fri Jan 07 07:45:38 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Wade,
I tested this one and did work completly
\\\
System.Diagnostics.Process p =
new System.Diagnostics.Process();
System.Diagnostics.ProcessStartInfo pi =
new System.Diagnostics.ProcessStartInfo();
pi.Arguments = "c:\\windows\\win.ini";
pi.FileName = "notepad.exe";
p.StartInfo = pi;
p.Start();
Are you starting this maybe from a Service or from a Webpage (what will not
work)
I hope this helps however?
Cor
|
|
|
|
 |
wadefleming

|
Posted: Mon Jan 10 09:16:14 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Thanks, but still did not work, same behaviour as before. However I am
trying to start it from an .aspx page (is this what you mean by
webpage?) If that isn't going to work, can you suggest an alternative
method?
|
|
|
|
 |
Cor

|
Posted: Mon Jan 10 10:20:14 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
Wade,
> Thanks, but still did not work, same behaviour as before. However I am
> trying to start it from an .aspx page (is this what you mean by
> webpage?) If that isn't going to work, can you suggest an alternative
> method?
When you start this, it should start on your "webserver" when you have given
your ASPNET user rights for accessing IE exe on your WebServer and I
strongly advice you not to do that.
I don't believe that this is the process you are after.
I think that this is better for what you probably want.
Not tested roughly changed from VBNet.
\\\
string str;
http://www.google.com');}
</script>";
RegisterStartupScript("Startup", str);
///
Cor
|
|
|
|
 |
Rick

|
Posted: Thu Feb 03 22:21:15 CST 2005 |
Top |
Visual C#.Net >> Error trying to open web page using System.Diagnostics.Process.Start
HI Wade, I ran into a similar problem and I found the answer at MS - of
all places. I added the
<identity inpersonate="true" /> tag to the web.config file. Fixed that
problem, but I ran into another. Oh well!
Rick.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
|
|
|
|
 |
|
|