Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 30th, 2008, 07:39 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default Error calling Outlook application

In my web page I am calling outlook from 2 different places.

This one works on my local development machine but not on the web server:

Code:
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click

        Dim prc As New Diagnostics.Process
        prc.StartInfo = New Diagnostics.ProcessStartInfo("outlook.exe")
        prc.Start()

End Sub
Get following error:

Quote:
quote:The system cannot find the file specified
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.ComponentModel.Win32Exception: The system cannot find the file specified

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:


[Win32Exception (0x80004005): The system cannot find the file specified]
System.Diagnostics.Process.StartWithShellExe cuteEx(ProcessStartInfo startInfo) +976
System.Diagnostics.Process.Start() +127
MasterPage.LinkButton1_Click(Object sender, EventArgs e) +65
System.Web.UI.WebControls.LinkButton.OnClick (EventArgs e) +105
System.Web.UI.WebControls.LinkButton.RaisePo stBackEvent(String eventArgument) +107
System.Web.UI.WebControls.LinkButton.System. Web.UI.IPostBackEventHandler.RaisePostBackEvent(St ring eventArgument) +7
System.Web.UI.Page.RaisePostBackEvent(IPostB ackEventHandler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePostBackEvent(NameVa lueCollection postData) +174
System.Web.UI.Page.ProcessRequestMain(Boolea n includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102

This code section works fine:

Code:
Protected Sub EmailButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles EmailButton.Click

        Dim myFileName As String = String.Format("\{0:yyyyMMdd_HHmmss}.doc", Date.Now)
        Dim myFilePath As String = "c:\windows\temp" + myFileName

        myCrystalReport.ExportToDisk(ExportFormatType.WordForWindows, myFilePath)

        Try
            Dim myProcess As System.Diagnostics.Process = New System.Diagnostics.Process()
            myProcess.StartInfo = New Diagnostics.ProcessStartInfo("outlook.exe", "/a " + ControlChars.Quote & myFilePath & ControlChars.Quote)
            myProcess.Start()
        Catch ex As Exception
            ErrorString = ex.ToString
            ASPNET_MsgBox("An error has occurred sending email: " + vbCrLf + ErrorString)
End Try
 
Old April 30th, 2008, 08:22 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

If the second way works, why not use it in the first part too?

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========
 
Old April 30th, 2008, 08:34 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Pne part calls Outlook without attachment and the second one calls Outlook with an attachment. The part with an attachment works.

Evereything works however on my local development machine.

 
Old April 30th, 2008, 08:37 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

Well, we have this discussion some days ago. You are calling a local app. on a web enviroment. So if you put this in a server, every time you call outlook, it will open on the server, not the client.

So this is not what you probably want...

HTH

Gonzalo

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
^^Took that from dparsons signature and he Took that from planoie's profile
================================================== =========
My programs achieved a new certification (can you say the same?):
WORKS ON MY MACHINE
http://www.codinghorror.com/blog/archives/000818.html
================================================== =========
I know that CVS was evil, and now i got the proof:
http://worsethanfailure.com/Articles...-Hate-You.aspx
================================================== =========





Similar Threads
Thread Thread Starter Forum Replies Last Post
[Resolved] Open Outlook application snufse .NET Framework 2.0 6 October 26th, 2008 10:53 PM
Sending Outlook Task thru Web Application gadhiav ASP.NET 1.0 and 1.1 Professional 9 March 5th, 2007 10:36 AM
How to add Macro in other OutLook Application VBA kvingupta All Other Wrox Books 0 April 3rd, 2006 05:38 AM
Server.CreateObject("Outlook.Application") Dave Sell Classic ASP Professional 1 September 4th, 2004 01:44 PM
Calling Outlook Express from Access VBA lmcharl Access VBA 1 September 8th, 2003 11:07 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.