473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

problem using UseShellExecute

I am using the code below to open Outlook as user clicks on "Email this
page"

try

{

string subjectEmail=string.Format("Magnet Alert Center - Alerts for :
{0}",Request.QueryString["accountid"]);

string messageEmail=string.Format("Dear recepient(s) ,you have been invited
to see alerts for {0}",Request.QueryString["accountid"]);

StartDefaultMail(subjectEmail,messageEmail);

}

catch (Exception ee)

{

throw new Exception("Error in initailizing components",ee);

}

}

private void StartDefaultMail(string subject,string message)

{

try

{

ProcessStartInfo psi=new ProcessStartInfo();

psi.UseShellExecute=true;

psi.FileName="mailto:" + HttpUtility.UrlEncode("") + "?subject=" +
HttpUtility.UrlEncode(subject) + "&body=" + HttpUtility.UrlEncode(message);

Process.Start(psi);

}

catch(Exception ee)

{

throw new Exception("Default mail client could not be started.",ee);
}

}

I get the following Error:

Cannot start process because a file name has not been provided.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Cannot start process
because a file name has not been provided.

Source Error:

An unhandled exception was generated during the execution of the
current web request. Information regarding the origin and location of the
exception can be identified using the exception stack trace below.

Stack Trace:

[InvalidOperationException: Cannot start process because a file name has not
been provided.]
System.Diagnostics.Process.Start() +135
System.Diagnostics.Process.Start(ProcessStartInfo startInfo) +49
MagNetAlertCenter.WebForm1.StartDefaultMail(String subject, String
message) in \\tech\magnetalertcenter\index.aspx.cs:111

[Exception: Default mail client could not be started.]
MagNetAlertCenter.WebForm1.StartDefaultMail(String subject, String
message) in \\tech\magnetalertcenter\index.aspx.cs:115
MagNetAlertCenter.WebForm1.LinkButton1_Click(Objec t sender, EventArgs e)
in \\vandevsps01\magnetalertcenter\index.aspx.cs:94

[Exception: Error in initailizing components]
MagNetAlertCenter.WebForm1.LinkButton1_Click(Objec t sender, EventArgs e)
in \\tech\magnetalertcenter\index.aspx.cs:98
System.Web.UI.WebControls.LinkButton.OnClick(Event Args e) +108

System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.Rai
sePostBackEvent(String eventArgument) +57
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler
sourceControl, String eventArgument) +18
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +138
System.Web.UI.Page.ProcessRequestMain() +

Nov 16 '05 #1
0 4272

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Barry Frank | last post by:
I am starting a process setting UseShellExecute to false and RedirectStardardOutput to true so that I can use StandardOutput.ReadToEnd to get the "screen" output of a command line program. When I...
1
by: Primo | last post by:
Hello, I am building a data management application with the following processes: Process 1 is a Windows service which uses FileSystemWatcher to monitor a directory. Process 2 opens a file...
1
by: Stephen Miller | last post by:
On my development machine (where the group 'Everyone' has full access to every directory), the following code successfully shells to a console application: Dim objShell As...
2
by: jcrouse | last post by:
I apologize for starting another thread but the old one had a weird subject line. Anyways...here is the code: Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...
1
by: John Crouse | last post by:
I am using the following code sucessfully on Windows 2000 and Windows XP. However, in WIndows 98 it seems to hang on the WaitForExit. What are my options here? MsgBox("Please be patient. This...
7
by: WALDO | last post by:
I wrote a console application that basically consumes arguments and starts other command line apps via System.Process. Let's call it XCompile for now. I wrote a Visual basic add-in that does pretty...
13
by: Chris Johnson | last post by:
I have what seems to be such a simple thing yet I cannot figure out how to do it. I am using a streamwriter to build a text file. At the end of the process I want to open that same text file in...
1
by: Robert | last post by:
Hello, I am doing an automatic backup service using c# and VS2003. To achieve this i must call an executable file. So far I have made it all work using Process, code looks like this: ...
5
by: =?Utf-8?B?Z215ZXJz?= | last post by:
Hello, I am attempting to start a cmd.exe process and pass several .vbs scripts (with additional parameters) and then read the output from the scripts and make "notes" in a DataTable (the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.