Wednesday, July 2, 2014

Methods to send an email from an ASP.net web page.

Hello,


I've hosted a website on GoDaddy.com, it is written in ASP.net 3.0 or 3.5 I believe in C#. I know you can send emails via the SMTP client but because of an issue with the trusted level of my web page, I can't send the email from GoDaddy.com. Are there any other methods I can employ to send an email from my web page that might work? I've contacted them and they mentioned that I would have to upgrade in order to possibly fix the issue and that really isn't an option. The page itself is just a test page, once the test is complete it will email the results. Any help with this is appreciated. Thanks.


This is the error I get:



[SecurityException: Request for the permission of type 'System.Net.Mail.SmtpPermission, System, 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() +58
System.Net.Mail.SmtpClient.Initialize() +128
System.Net.Mail.SmtpClient..ctor(String host, Int32 port) +220
Med_Sedation_Test._Default.btnSubmit_Click(Object sender, EventArgs e) +518
System.EventHandler.Invoke(Object sender, EventArgs e) +0
System.Web.UI.WebControls.Button.OnClick(EventArgs e) +111
System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +110
System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection 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(HttpContext context) +21
System.Web.UI.Page.ProcessRequest(HttpContext context) +49
ASP.default_aspx.ProcessRequest(HttpContext context) in App_Web_fqhlulov.0.cs:0
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75


No comments:

Post a Comment