473,408 Members | 2,734 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,408 software developers and data experts.

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.SecurityException: Request for the permission of type
System.Security.Permissions.SecurityPermission, mscorlib, Version=1.0.5000.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.

Here's the code
Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
objOutlook = CreateObject("Outlook.Application")
objOutlookMsg =
objOutlook.CreateItem(Outlook.OlItemType.olMailIte m)
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 1701
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******@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
| When attempting to load an Oulook Object in ASP.Net (VB) I get the
foloowing
| error on the Server:
|
| System.Security.SecurityException: Request for the permission of type
| System.Security.Permissions.SecurityPermission, mscorlib,
Version=1.0.5000.0,
| Culture=neutral, PublicKeyToken=b77a5c561934e089 failed.
|
| Here's the code
| Dim objOutlook As New Outlook.Application
| Dim objOutlookMsg As Outlook.MailItem
| objOutlook = CreateObject("Outlook.Application")
| objOutlookMsg =
| objOutlook.CreateItem(Outlook.OlItemType.olMailIte m)
| 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
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...
8
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...
5
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,...
16
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
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
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.