Top VPS Hosting Provider

Welcome to the myhosting.com Forums.
+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    rajiv is offline Junior Member
    Join Date
    May 2010
    Posts
    1

    Post Problems occur While sending mail with attachment on myhosting server

    hi firend,
    I created website using Visual studio 2008 and SP.NET 3.5 version. uplaoding this website into myhosting server of ComputerTekk Inc domain. while sending mail from server its working fine. but sending mail with attachment its getting following error:

    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.


    but sending mail with attachment in localhost working fine. What to do.

    please help me.
    Thanks in advance.

  2. #2
    nickh is offline Administrator
    Join Date
    May 2009
    Location
    Toronto, Canada
    Posts
    142

    Default

    Hi there, Rajiv. I've escalated this to our Operations team. They'll look into it as soon as possible. When I hear back from them, I'll give you a shout.

    Thanks for your patience. Cheers,
    Nick
    Nick Hoffman
    Software Developer
    SoftCom Inc.

  3. #3
    nickh is offline Administrator
    Join Date
    May 2009
    Location
    Toronto, Canada
    Posts
    142

    Default

    Hey Rajiv. Our Operations department looked into this, and tested the page in question. They highlighted this line from the full error message:
    Code:
    VMS.Campaigner.sendmail.btnSubmit_Click(Object sender, EventArgs e) in sendmail.aspx.cs:71
    and said:

    In sendmail.aspx , FileUpload1.Posted on line 70 is an instance of the HttpPostedFile class. This works on the customer's localhost but not on myhosting.com's server (or any other) because HttpPostedFile.FileName is the fully-qualified name of the file on the client's computer.

    In other words, if C:\file.txt is uploaded, sendmail.aspx tries to attach that specific file to the email. However, doing so fails because C:\file.txt doesn't exist on the myhosting.com server.

    The customer should:
    1. Use HttpPostedFile.SaveAs to save the posted file to a temporary file on the server.
    2. Attach the temporary file to the email.
    3. Send the email.
    4. Delete the temporary file.
    Nick Hoffman
    Software Developer
    SoftCom Inc.


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts