mvc4 web api没有保存整个html数据只保存了一半的数据

时间:2013-09-15 11:52:35

标签: html asp.net-mvc-4 razor asp.net-web-api email-templates

我正在使用带有ASP.NET MVC4的ASP.NET WebApi,它正在创建HTML数据的问题,整个HTML没有保存在数据库中,只有一半的数据可以用html数据保存......

请告诉我这是什么问题?

//的WebAPI

  //insert
        [ValidateModelState]
        [ValidateJsonAntiForgeryTokenAttribute]
        public HttpResponseMessage SetEmailTemplate(EmailTemplateModel objEmailTemplateModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    //check for title is exists or not
                    EmailTemplatePOCO objEmailTemplatePOCOByTitle = EmailTemplateDA.GetEmailTemplateByTitle(objEmailTemplateModel.Title);

                    if (objEmailTemplatePOCOByTitle != null)
                    {
                        return this.Request.CreateResponse(
                                        HttpStatusCode.OK,
                                        new
                                        {
                                            Success = "Duplicate"
                                        });
                    }
                    else
                    {

                        //inser email template page
                        var objEmailTemplatePoco = new EmailTemplatePOCO()
                        {
                            EmailTemplateId = Guid.NewGuid(),
                            Title = objEmailTemplateModel.Title,
                            Subject = objEmailTemplateModel.Subject,
                            Description = objEmailTemplateModel.Description,
                            CreatedDate = DateTime.UtcNow,
                            IsActive = objEmailTemplateModel.IsActive
                        };
                        EmailTemplateDA.InsertEmailTemplate(objEmailTemplatePoco);

                        return this.Request.CreateResponse(
                                        HttpStatusCode.OK,
                                        new
                                        {
                                            Success = true
                                        });
                    }

                }
            }
            catch (Exception ex)
            {

                throw ex;
            }

            return null;
        }

//调试模式html只显示这个并保存了这半个HTML ...

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
</head>
<body style="padding: 0; margin: 0; background: #fff; font-family: 'PT Sans', sans-serif !important; font-size: 12px!important; line-height: 20px; color: #333; background-color: #fff">
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>
            <td align="center">
                <div style="padding: 0; width: 100%; max-width: 600px;">
                    <div style="padding: 0; margin: 0; background: url($$$SiteUrl$$$/Content/images/bg-wrapper.jpg) repeat-x; background-size: auto; width: 100%; float: left">
                        <div style="padding: 0; margin: 0 auto; max-width: 990px; width: 100%">
                            <div style="padding: 0; margin: 0; height: 121px; float: left; max-width: 990px; position: relative; width: 100%">
                                <div style="padding: 0; margin: 0; width: 27%; min-width: 266px; height: 93%; float: left; margin-top: 0.5%">
                                    <a href="#" style="padding: 0; margin: 0; background: url($$$SiteUrl$$$/Content/images/logo.png) no-repeat; width: 100%; height: 100%; display: block; color: #08c; text-decoration: none">
                                        <img src="$$$SiteUrl$$$/Content/images/logo.png" style="padding: 0; margin: 0; width: auto; height: auto; max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic" /></a>
                                </div>

                                <div style="padding-top: 5%; margin: 0; width: 54%; min-width: 266px; height: 93%; float: left; margin-top: 0.5%">
                                    <img src="$$$SiteUrl$$$/Content/images/icon-hearts.png" style="padding: 0; margin: 0; width: auto; height: auto; max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic" />
                                    <span style="padding: 0; margin: 0; font-family: Georgia, Times New Roman , Times, serif; font-size: 16px; color: #fff; font-style: italic;">...a haven for Africans abroad</span>
                                </div>

                            </div>

                        </div>
                    </div>
                    <div style="padding: 0; margin: 0; background: url($$$SiteUrl$$$/Content/images/bg-wrapper-whole-container.png) repeat-x #fff; width: 100%; float: left; text-align: left;">
                        <div style="padding: 0; margin: auto; max-width: 990px; width: 100%">
                            <div style="padding: 2% !important; margin: 0; border-left: 1px solid #F8F2E0; border-right: 1px solid #F8F2E0;">
                                <img src="$$$SiteUrl$$$/Content/images/bullet-heart.png" style="padding: 0; margin: 0; width: auto; height: auto; max-width: 100%; vertical-align: middle; border: 0; -ms-interpolation-mode: bicubic" />
                                <span style="font-size: 14px;">Hello,</span>
                                <div style="padding: 0; margin: 0; height: 15px;"></div>

0 个答案:

没有答案