Announcement Announcement Module
Collapse

myhosting.com Forum Guidelines

Welcome to the myhosting.com Forums! The purpose of this forum is to allow you to discuss topics relating to hosting and topics of interest with other myhosting.com Customers. The primary focus should relate to issues not generally included in our Wiki or Control Panel, or information not provided by our Customer Support Team. Some examples include programming and coding support, web site design ideas and SEO practices.

The forum is not meant as a replacement to our Wiki or Customer Support. We highly recommend searching our Wiki before posting on the forum. Also, if you have a question for our Customer Support team, please contact them as you would normally.

We ask that if you have any complaints or questions relating specifically to your account, that you address them to our Customer Support department. Do not post personal account information such as passwords or other sensitive and private information the forum, as this type of information is best kept secret. Also, please be respectful of other users and refrain from defamatory comments or use of coarse language.

We will visit the forum from time to time, and contribute to various topics. We reserve the right to delete any posts which are deemed offensive or against the spirit of the forum. Any spamming or illegal activity will not be tolerated. We also reserve the right to block any user who violates these guidelines.

To get started, we welcome you to sign up at our User Management site. Any account created there will have access to these forums, our Wiki, our Ideas site and commenting permission on our Status Blog.
See more
See less
Problem Sending Email Attachment from .NET 2.0 ASPX Page Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem Sending Email Attachment from .NET 2.0 ASPX Page

    Here is the full text of the exception:

    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:


    Line 57: if (txtAttachment.Text.Length > 0)
    Line 58: {
    Line 59: attachment = new Attachment(txtAttachment.Text, MediaTypeNames.Application.Octet);
    Line 60:
    Line 61: // Add time stamp information for the file.

    Source File: e:\inetpub\clients\daar-ul-ehsaan.org\DataEntry\SendEmail.Aspx.cs Line: 59

    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(Obj ect demand, StackCrawlMark& stackMark, Boolean isPermSet) +0
    System.Security.CodeAccessPermission.Demand() +58
    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) +644
    System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +66
    System.Net.Mail.AttachmentBase.SetContentFromFile( String fileName, String mediaType) +76
    System.Net.Mail.AttachmentBase..ctor(String fileName, String mediaType) +36
    System.Net.Mail.Attachment..ctor(String fileName, String mediaType) +20
    SendEmail.Button1_Click(Object sender, EventArgs e) in e:\inetpub\clients\daar-ul-ehsaan.org\DataEntry\SendEmail.Aspx.cs:59
    System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
    System.Web.UI.WebControls.Button.RaisePostBackEven t(String eventArgument) +110
    System.Web.UI.WebControls.Button.System.Web.UI.IPo stBackEventHandler.RaisePostBackEvent(String eventArgument) +10
    System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument) +13
    System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData) +36
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +6785
    System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +242
    System.Web.UI.Page.ProcessRequest() +80
    System.Web.UI.Page.ProcessRequestWithNoAssert(Http Context context) +21
    System.Web.UI.Page.ProcessRequest(HttpContext context) +49
    ASP.dataentry_sendemail_aspx.ProcessRequest(HttpCo ntext context) in App_Web_sendemail.aspx.c182f6a3.nbjcknuq.0.cs:0
    System.Web.CallHandlerExecutionStep.System.Web.Htt pApplication.IExecutionStep.Execute() +181
    System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean& completedSynchronously) +75

    Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618

    How and where do I change the security?
    The file in question is located at www.daar-ul-ehsaan.org\dataentry\The Biggest.pdf

    Thanks in advance

    Isa Paine
    What do I do?

  • #2
    Hi Isa Paine,

    Hope this solution helps;
    adding this to the web.config under system.web : <trust level="Full" />
    "System.Security.SecurityException: Security error" error message when the virtual directory points to a remote share in ASP.NET

    Cheers
    Last edited by suwunk; 2011-01-13, 05:37 AM.

    Comment

    Working...
    X