将Aspx Webform提交到电子邮件 [英] Submitting Aspx Webform to Email

查看:69
本文介绍了将Aspx Webform提交到电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我在asp.net中有一种调查形式.当我们尝试提交时,我们不断收到错误消息,该错误消息位于cs文件中,"Servey无法提交,请重试或稍后再试".这里的拼写错误,因此我将其更改为更正,即无法提交调查,请重试或稍后再试".之后,我在VS2008中使用Build选项,然后删除了预编译的文件,然后再次发布了网站,然后使用了预编译的文件,但是它无法正常工作,并收到错误提示拼写相同的错误消息"Servey无法提交,请重试或更高版本".我正在使用IIS7托管网站.

这是CS文件中的代码:

Hi All,

I have a survey kind of form in asp.net. When we try to submit we keep getting an error message which is in the cs file that "Servey could not submitted,Please try again or later". Here the spelling was incorrect so i changed it to correct i.e. "Survey could not submited,Please try again or later". After that i use the Build option in VS2008 and then deleted the precompiled file and then published the website again and then used the precomplied file but its not working and keep getting the same error message with wrong spelling "Servey could not submitted,Please try again or later". I am using IIS7 to host the website.

Here''s the code in cs file:

    htbl["@HtmlPage"] = sbTableData.ToString();
    string _From = ConfigurationManager.AppSettings["MailFrom"].ToString();

    //string _To = ConfigurationManager.AppSettings["MailTo"].ToString();
    //string _To = "email@abc.com";

     string _to = string.Empty;

switch(ddlRegion.SelectedItem.Value)
{
case "1": _to = ConfigurationManager.AppSettings["MailToA"]; break;
case "2": _to = ConfigurationManager.AppSettings["MailToB"]; break;
case "3": _to = ConfigurationManager.AppSettings["MailToC"]; break;
case "4": _to = ConfigurationManager.AppSettings["MailToD"]; break;
}
    string[] arrFile = new string[0];

    if (CommonUI.SendEmail(_From, _to, "Survey", true, arrFile, htbl))
    {
        Response.Redirect("ThankYou.html");

    }
    else
    {
         Response.Write(_to);
        //ScriptManager.RegisterClientScriptBlock(this, GetType(), "K1", "alert('Survey could not submited,Please try again or later')", true);

    }



    #endregion

}



有人可以帮我吗.我真的被困住了.我将不胜感激任何帮助.提前致谢.如果您需要更多信息,请让我知道.



Could somebody please help me. I am really stuck. I would appreciate any help. Thanks in advance. If you require any more info please let me know.

推荐答案

尝试放入try catch

如果(CommonUI.SendEmail(_From,_to,"Survey",true,arrFile,htbl))
{
Response.Redirect("ThankYou.html");

}
查看收到的错误消息
Try to put try catch

if (CommonUI.SendEmail(_From, _to, "Survey", true, arrFile, htbl))
{
Response.Redirect("ThankYou.html");

}
See what error message you are getting


安装了Visual Studio 2010,重新安装了IIS,现在一切正常.
Installed Visual studio 2010 and re-installed IIS and all ok now.


这篇关于将Aspx Webform提交到电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆