Click here to Skip to main content
15,896,606 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionAccessing Html controls created in javascript Pin
Rajaraman Soundararajan20-Nov-06 17:32
Rajaraman Soundararajan20-Nov-06 17:32 
QuestionPlease Help! INCLUDE PAGE from Variable Pin
steeleimaging20-Nov-06 16:39
steeleimaging20-Nov-06 16:39 
QuestionHow to Create an Invoice-like Form in ASP NET 2.0 Pin
ezani20-Nov-06 16:24
ezani20-Nov-06 16:24 
QuestionDesigning an Email application Pin
hasanali0020-Nov-06 11:52
hasanali0020-Nov-06 11:52 
AnswerRe: Designing an Email application Pin
Tal Kain20-Nov-06 15:01
Tal Kain20-Nov-06 15:01 
QuestionServer Side Localization Pin
Filipe Peixinho20-Nov-06 10:53
Filipe Peixinho20-Nov-06 10:53 
AnswerRe: Server Side Localization Pin
indianet20-Nov-06 15:03
indianet20-Nov-06 15:03 
QuestionEmail Error Pin
shapper20-Nov-06 10:37
shapper20-Nov-06 10:37 
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.SecurityException: Request for the
permission of type 'System.Security.Permissions.FileIOPermission,
mscorlib, Version=2.0.0.0, Culture=neutral,
PublicKeyToken=b77a5c561934e089' 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:

[SecurityException: Request for the permission of type
'System.Security.Permissions.FileIOPermission, mscorlib,
Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'
failed.]
System.Security.CodeAccessSecurityEngine.Check(Object demand,
StackCrawlMark& stackMark, Boolean isPermSet) +0
System.Security.CodeAccessPermission.Demand() +59
System.IO.FileStream.Init(String path, FileMode mode, FileAccess
access, Int32 rights, Boolean useRights, FileShare share, Int32
bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String
msgPath, Boolean bFromProxy) +678
System.IO.FileStream..ctor(String path, FileMode mode, FileAccess
access, FileShare share) +114

System.Configuration.Internal.InternalConfigHost.StaticOpenStreamForRead(String
streamName) +80

System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String
streamName, Boolean assertPermissions) +115

System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.OpenStreamForRead(String
streamName) +7

System.Configuration.Internal.DelegatingConfigHost.OpenStreamForRead(String
streamName) +10
System.Configuration.UpdateConfigHost.OpenStreamForRead(String
streamName) +42
System.Configuration.BaseConfigurationRecord.InitConfigFromFile()
+443

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(ByVal sender As Object, ByVal e As System.EventArgs) 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(tbEmail.Text, tbName.Text)
17 Else
18 .From = New System.Net.Mail.MailAddress(tbEmail.Text)
19 End If
20
21 ' Define subject
22 If Me.SubjectVisible 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 configurationFile As Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~/Web.Config")
33
34 ' Create mail settings section group
35 Dim mailSettings As System.Net.Configuration.MailSettingsSectionGroup = configurationFile.GetSectionGroup("system.net/mailSettings")
36
37 ' Define smtp client properties
38 If Not mailSettings Is Nothing Then
39 With smtpClient
40 .Port = mailSettings.Smtp.Network.Port
41 .Host = mailSettings.Smtp.Network.Host
42 .Credentials = New System.Net.NetworkCredential(mailSettings.Smtp.Network.UserName, mailSettings.Smtp.Network.Password)
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


AnswerRe: Email Error Pin
indianet20-Nov-06 14:50
indianet20-Nov-06 14:50 
QuestionAlter Tooltip property of TableRow in UserControl Pin
pahlsson20-Nov-06 8:33
pahlsson20-Nov-06 8:33 
AnswerRe: Alter Tooltip property of TableRow in UserControl Pin
indianet20-Nov-06 10:55
indianet20-Nov-06 10:55 
QuestionRegistering server control ID Pin
Krrish20-Nov-06 7:43
Krrish20-Nov-06 7:43 
AnswerRe: Registering server control ID Pin
iamrashida8320-Nov-06 8:20
iamrashida8320-Nov-06 8:20 
QuestionInvalid postback or callback argument Pin
Krrish20-Nov-06 7:33
Krrish20-Nov-06 7:33 
AnswerRe: Invalid postback or callback argument Pin
Grapes-R-Fun20-Nov-06 9:30
Grapes-R-Fun20-Nov-06 9:30 
AnswerRe: Invalid postback or callback argument Pin
indianet20-Nov-06 14:56
indianet20-Nov-06 14:56 
QuestionDownloading Image Pin
Marek Konieczny20-Nov-06 7:25
Marek Konieczny20-Nov-06 7:25 
AnswerRe: Downloading Image Pin
iamrashida8320-Nov-06 8:30
iamrashida8320-Nov-06 8:30 
GeneralRe: Downloading Image Pin
iamrashida8320-Nov-06 8:34
iamrashida8320-Nov-06 8:34 
GeneralRe: Downloading Image Pin
Marek Konieczny20-Nov-06 23:25
Marek Konieczny20-Nov-06 23:25 
GeneralRe: Downloading Image Pin
minhpc_bk20-Nov-06 23:44
minhpc_bk20-Nov-06 23:44 
QuestionBest way to maintain web application state? Pin
Rip Kirby20-Nov-06 4:38
Rip Kirby20-Nov-06 4:38 
AnswerRe: Best way to maintain web application state? Pin
indianet20-Nov-06 5:32
indianet20-Nov-06 5:32 
Questiondefinition of print() function in javscript Pin
yogita charhate20-Nov-06 3:56
yogita charhate20-Nov-06 3:56 
AnswerRe: definition of print() function in javscript Pin
indianet20-Nov-06 5:33
indianet20-Nov-06 5:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.