473,666 Members | 2,528 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Security Error Attempting to Create Outlook Object in .NET

When attempting to load an Oulook Object in ASP.Net (VB) I get the foloowing
error on the Server:

System.Security .SecurityExcept ion: Request for the permission of type
System.Security .Permissions.Se curityPermissio n, mscorlib, Version=1.0.500 0.0,
Culture=neutral , PublicKeyToken= b77a5c561934e08 9 failed.

Here's the code
Dim objOutlook As New Outlook.Applica tion
Dim objOutlookMsg As Outlook.MailIte m
objOutlook = CreateObject("O utlook.Applicat ion")
objOutlookMsg =
objOutlook.Crea teItem(Outlook. OlItemType.olMa ilItem)
With objOutlookMsg
.Recipients.Add (RecipientEmail )
.Subject = _MAIL_SUBJECT
.HTMLBody = strStaticBody
.Display()
End With
objOutlookMsg = Nothing
objOutlook = Nothing
I have a reference to the DLL
Jan 4 '06 #1
2 1711
sakieboy,
Outlook is not designed to be run from an ASP.NET app!

| .Display()
Will attempt to display the outlook form on the server itself. If you are
attempting to display the user's Outlook client, then I would recommend
rethinking what you are doing as that is extremely virus like!
To simply send an email on the server I would recommend:

System.Web.Mail (.NET 1.x) :
http://msdn.microsoft.com/library/de...temwebmail.asp

http://www.systemwebmail.com/

or System.Net.Mail (.NET 2.0) instead:
http://msdn2.microsoft.com/en-us/lib....net.mail.aspx

--
Hope this helps
Jay [MVP - Outlook]
..NET Application Architect, Enthusiast, & Evangelist
T.S. Bradley - http://www.tsbradley.net
"sakieboy" <sa******@discu ssions.microsof t.com> wrote in message
news:EF******** *************** ***********@mic rosoft.com...
| When attempting to load an Oulook Object in ASP.Net (VB) I get the
foloowing
| error on the Server:
|
| System.Security .SecurityExcept ion: Request for the permission of type
| System.Security .Permissions.Se curityPermissio n, mscorlib,
Version=1.0.500 0.0,
| Culture=neutral , PublicKeyToken= b77a5c561934e08 9 failed.
|
| Here's the code
| Dim objOutlook As New Outlook.Applica tion
| Dim objOutlookMsg As Outlook.MailIte m
| objOutlook = CreateObject("O utlook.Applicat ion")
| objOutlookMsg =
| objOutlook.Crea teItem(Outlook. OlItemType.olMa ilItem)
| With objOutlookMsg
| .Recipients.Add (RecipientEmail )
| .Subject = _MAIL_SUBJECT
| .HTMLBody = strStaticBody
| .Display()
| End With
| objOutlookMsg = Nothing
| objOutlook = Nothing
| I have a reference to the DLL
Jan 4 '06 #2
Jay B. Harlow [MVP - Outlook] wrote:
sakieboy,
Outlook is not designed to be run from an ASP.NET app!

| .Display()
Will attempt to display the outlook form on the server itself. If you are
attempting to display the user's Outlook client, then I would recommend
rethinking what you are doing as that is extremely virus like!
To simply send an email on the server I would recommend:

System.Web.Mail (.NET 1.x) :
http://msdn.microsoft.com/library/de...temwebmail.asp

http://www.systemwebmail.com/

or System.Net.Mail (.NET 2.0) instead:
http://msdn2.microsoft.com/en-us/lib....net.mail.aspx


And to be more exact on why you are getting the error you are getting.
The asp.net user does not have permission to open outlook.

Chris
Jan 4 '06 #3

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

Similar topics

3
7059
by: Robert Hogan | last post by:
Hello, I am attempting to send emails using T-SQL (in a SQLServerAgent Job) using the stored procedure sp_SendSMTPMail. I created the stored proc using the following script that I got off a post here on google. CREATE PROCEDURE sp_SendSMTPMail (@From varchar(255), @To varchar(8000), @Subject varchar(255), @Body varchar(8000),
8
10003
by: Rod | last post by:
I have been working with ASP.NET 1.1 for quite a while now. For some reason, opening some ASP.NET applications we wrote is producing the following error message: "The Web server reported the following error when attempting to create or open the Web project located at the following URL: 'http://localhost/WebApplication1'. 'HTTP/1.1 500 Internal Server Error'."
5
2056
by: Norsoft | last post by:
I have a .Net 1.1 application which is downloaded into an aspx page. It is a dll which inherits from System.Windows.Forms.UserControl. It works fine on a PC with only the 1.1 Framework. However, the control will not load on a PC with the 2.0 Framework installed. I know that IE will use the newest framework so I assume it is a security issue. At the assembly level I apply the following attributes;
16
4351
by: ML | last post by:
Is there anyway to get around the security prompt from Outlook when using the object in a vb.net winforms app? I want to be able to load the contacts lists from Outlook but each time it access it you get the security warning.
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8352
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8863
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8549
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8636
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5661
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4192
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4358
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2005
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.