473,748 Members | 10,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Email Problem

Hello,

I have a contact form in my web site which is working just fine on my
computer!

When I uploaded my web site to my hosting server I get an error when I
SUBMIT my form, i.e., when I click submit to send the email:

Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application's trust level in the configuration file.

Exception Details: System.Security .SecurityExcept ion: Request for the
permission of type 'System.Securit y.Permissions.F ileIOPermission ,
mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9' failed.

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:

[SecurityExcepti on: Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed.]
System.Security .CodeAccessSecu rityEngine.Chec k(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security .CodeAccessPerm ission.Demand() +59
System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
msgPath, Boolean bFromProxy) +678
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share) +114

System.Configur ation.Internal. InternalConfigH ost.StaticOpenS treamForRead(St ring
streamName) +80

System.Configur ation.Internal. InternalConfigH ost.System.Conf iguration.Inter nal.IInternalCo nfigHost.OpenSt reamForRead(Str ing
streamName, Boolean assertPermissio ns) +115

System.Configur ation.Internal. InternalConfigH ost.System.Conf iguration.Inter nal.IInternalCo nfigHost.OpenSt reamForRead(Str ing
streamName) +7

System.Configur ation.Internal. DelegatingConfi gHost.OpenStrea mForRead(String
streamName) +10
System.Configur ation.UpdateCon figHost.OpenStr eamForRead(Stri ng
streamName) +42
System.Configur ation.BaseConfi gurationRecord. InitConfigFromF ile()
+443
Does anyone has any idea why is this happening?

Thank You Very Much,

Miguel

Nov 20 '06 #1
2 1518
Hey shapper,

A litte more info will help
1) Is it a particular form or just any form
2) If it is just one form, what does the code in the submit button do?

On 20 Nov 2006 09:05:20 -0800, "shapper" <md*****@gmail. comwrote:
>Hello,

I have a contact form in my web site which is working just fine on my
computer!

When I uploaded my web site to my hosting server I get an error when I
SUBMIT my form, i.e., when I click submit to send the email:

Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application' s trust level in the configuration file.

Exception Details: System.Security .SecurityExcept ion: Request for the
permission of type 'System.Securit y.Permissions.F ileIOPermission ,
mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken =b77a5c561934e0 89' failed.

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:

[SecurityExcepti on: Request for the permission of type
'System.Securi ty.Permissions. FileIOPermissio n, mscorlib,
Version=2.0.0. 0, Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed.]
System.Security .CodeAccessSecu rityEngine.Chec k(Object demand,
StackCrawlMark & stackMark, Boolean isPermSet) +0
System.Security .CodeAccessPerm ission.Demand() +59
System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
msgPath, Boolean bFromProxy) +678
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share) +114

System.Configu ration.Internal .InternalConfig Host.StaticOpen StreamForRead(S tring
streamName) +80

System.Configu ration.Internal .InternalConfig Host.System.Con figuration.Inte rnal.IInternalC onfigHost.OpenS treamForRead(St ring
streamName, Boolean assertPermissio ns) +115

System.Configu ration.Internal .InternalConfig Host.System.Con figuration.Inte rnal.IInternalC onfigHost.OpenS treamForRead(St ring
streamName) +7

System.Configu ration.Internal .DelegatingConf igHost.OpenStre amForRead(Strin g
streamName) +10
System.Configur ation.UpdateCon figHost.OpenStr eamForRead(Stri ng
streamName) +42
System.Configur ation.BaseConfi gurationRecord. InitConfigFromF ile()
+443
Does anyone has any idea why is this happening?

Thank You Very Much,

Miguel
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 20 '06 #2
Hi,

Maybe the error comes from me getting data from Web.Config?

I have this code inside a custom control but here it is:
1 Private Sub bSubmit_Click(B yVal sender As Object, ByVal e As
System.EventArg s) Handles bSubmit.Click
2
3 ' Create new mail message
4 Dim message As New System.Net.Mail .MailMessage
5
6 ' Define mail message properties
7 With message
8
9 ' Define various properties
10 .To.Add(New System.Net.Mail .MailAddress(Me .ToAddress,
Me.ToName))
11 .Body = tbMessage.Text
12 .IsBodyHtml = True
13
14 ' Define fromMailAddress
15 If Me.NameVisible Then
16 .From = New System.Net.Mail .MailAddress(tb Email.Text,
tbName.Text)
17 Else
18 .From = New System.Net.Mail .MailAddress(tb Email.Text)
19 End If
20
21 ' Define subject
22 If Me.SubjectVisib le Then
23 .Subject = tbSubject.Text
24 End If
25
26 End With
27
28 ' Create and define the SMTP client
29 Dim smtpClient As New System.Net.Mail .SmtpClient
30
31 ' Create access to configuration file
32 Dim configurationFi le As Configuration =
System.Web.Conf iguration.WebCo nfigurationMana ger.OpenWebConf iguration("~/Web.Config")
33
34 ' Create mail settings section group
35 Dim mailSettings As
System.Net.Conf iguration.MailS ettingsSectionG roup =
configurationFi le.GetSectionGr oup("system.net/mailSettings")
36
37 ' Define smtp client properties
38 If Not mailSettings Is Nothing Then
39 With smtpClient
40 .Port = mailSettings.Sm tp.Network.Port
41 .Host = mailSettings.Sm tp.Network.Host
42 .Credentials = New
System.Net.Netw orkCredential(m ailSettings.Smt p.Network.UserN ame,
mailSettings.Sm tp.Network.Pass word)
43 End With
44 End If
45
46 ' Send the mail message and define sent property
47 Try
48
49 ' Send the mail message
50 smtpClient.Send (message)
51
52 ' Define sent property
53 Me.Sent = True
54
55 Catch ex As Exception
56
57 ' Define sent property
58 Me.Sent = False
59
60 End Try
61
62 ' Raise the OnFormSubmited event
63 RaiseEvent FormSubmited(Me , EventArgs.Empty )
64
65 End Sub

Maybe the problem comes from line 32? I am sure about this ...

Anyway, could someone help me out and send me some sugestions?

Thanks,

Miguel

Rad [Visual C# MVP] wrote:
Hey shapper,

A litte more info will help
1) Is it a particular form or just any form
2) If it is just one form, what does the code in the submit button do?

On 20 Nov 2006 09:05:20 -0800, "shapper" <md*****@gmail. comwrote:
Hello,

I have a contact form in my web site which is working just fine on my
computer!

When I uploaded my web site to my hosting server I get an error when I
SUBMIT my form, i.e., when I click submit to send the email:

Security Exception
Description: The application attempted to perform an operation not
allowed by the security policy. To grant this application the required
permission please contact your system administrator or change the
application's trust level in the configuration file.

Exception Details: System.Security .SecurityExcept ion: Request for the
permission of type 'System.Securit y.Permissions.F ileIOPermission ,
mscorlib, Version=2.0.0.0 , Culture=neutral ,
PublicKeyToken= b77a5c561934e08 9' failed.

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:

[SecurityExcepti on: Request for the permission of type
'System.Securit y.Permissions.F ileIOPermission , mscorlib,
Version=2.0.0.0 , Culture=neutral , PublicKeyToken= b77a5c561934e08 9'
failed.]
System.Security .CodeAccessSecu rityEngine.Chec k(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security .CodeAccessPerm ission.Demand() +59
System.IO.FileS tream.Init(Stri ng path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIB UTES secAttrs, String
msgPath, Boolean bFromProxy) +678
System.IO.FileS tream..ctor(Str ing path, FileMode mode, FileAccess
access, FileShare share) +114

System.Configur ation.Internal. InternalConfigH ost.StaticOpenS treamForRead(St ring
streamName) +80

System.Configur ation.Internal. InternalConfigH ost.System.Conf iguration.Inter nal.IInternalCo nfigHost.OpenSt reamForRead(Str ing
streamName, Boolean assertPermissio ns) +115

System.Configur ation.Internal. InternalConfigH ost.System.Conf iguration.Inter nal.IInternalCo nfigHost.OpenSt reamForRead(Str ing
streamName) +7

System.Configur ation.Internal. DelegatingConfi gHost.OpenStrea mForRead(String
streamName) +10
System.Configur ation.UpdateCon figHost.OpenStr eamForRead(Stri ng
streamName) +42
System.Configur ation.BaseConfi gurationRecord. InitConfigFromF ile()
+443
Does anyone has any idea why is this happening?

Thank You Very Much,

Miguel
--

Bits.Bytes.
http://bytes.thinkersroom.com
Nov 20 '06 #3

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

Similar topics

3
1931
by: jpastora | last post by:
I'm having a strange problem with our email links on the domain : http://www.pc350.com/ . The problem is that when you click on an email link, the email app is not launched until the browser window is minimized or you switch to a different application. Please try clicking on any email link to know what I'm talking about. The code has been thoroughly checked, I found no errors. The thing is, this behaviour has something to do with the...
6
3480
by: mike | last post by:
I have created a side application in VB.NET which reads rows from a DB and builds an email message. when i have a long string the the mailmessage.body or the mailmessage, it puts in an "!<linefeed><space>" at about every 980th space. I have confirmed that these characters are not in the string or the message body before the email is sent. Has anyone seen this or have any thoughts? Thanks
88
12538
by: Mike | last post by:
Is there a way to determine what a user's default email client is? I read a post from 3 years ago that said no. I guess I'm hoping something has come along since then.
0
2147
by: VP | last post by:
g'day, i am posting a problem i have encountered with creating an email using outlook through some basic c# code. the problem arises when using different email editors in outlook. At the moment i am using outlook 2000. Outlook can be configured to use the default outlook email editor or use ms word as the email editor in outlook. The sample code below simply creates an email with a hyperlink. The problem I am facing is that when...
14
9142
by: supz | last post by:
Hi, I use the standard code given below to send an email from an ASP.NET web form. The code executes fine but no Email is sent. All emails get queued in the Inetpub mail queue. I'm using my local default SMTP Server and my from address is a valid Yahoo/Hotmail address. I have configures the local SMTP Server to allow the IP Address 127.0.0.1.
26
2791
by: libsfan01 | last post by:
Hi all! Can anyone show me how to check and email field on a form for the existence of these two characters. Kind regards Marc
0
4222
by: RickVidallon | last post by:
Missing or Truncated Body Text in Email Application - 2 Strange Examples... There is no earthly reason why this is happening! EXAMPLES HERE: http://65.36.227.70/actmailer/ We have a scheduled task which runs every 5mins and sends pending email campaign. The script has been written in VB.NET and following is the code which
3
3837
by: Steven Allport | last post by:
I am working on processing eml email message using the email module (python 2.5), on files exported from an Outlook PST file, to extract the composite parts of the email. In most instances this works fine, the message is read in using message_from_file, is_multipart returns True and I can process each component and extract message attachments. I am however running into problem with email messages that contain emails forwarded as...
3
8969
by: IGD | last post by:
I don't know if this is the right place to post this or not. If not, could someone direct me elsewhere where I would find more information on how to solve my problem? Thanks! My problem is this: I am writing an application for work. This application sends a basic html email via SMTP to a group. In this group are individual people's emails, but also about 5 other groups. The problem is that the email is only getting received by (or sent...
28
4429
tdw
by: tdw | last post by:
Hi all, I am trying to add a feature to our database that automates sending emails. When entering a new order, I want the option to send an email to the company the order came from, attaching a copy of our work order. The file that I want to attach is a rich text document created by Access and stored on our server. The creation of this document is not the problem. The problem is getting the email option to work. It does not seem to...
0
8984
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
8823
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
9530
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...
0
9363
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9238
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
8237
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6793
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4593
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...
2
2775
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.