mvc4 wep api未保存全部html数据仅保存一半数据
我正在使用ASP.NET WebApi和ASP.NET MVC4,它正在创建一个HTML数据问题,整个HTML没有保存在数据库中,只有一半的数据可以用HTML数据保存 请让我知道是什么问题 //webapimvc4 wep api未保存全部html数据仅保存一半数据,html,asp.net-mvc-4,razor,asp.net-web-api,email-templates,Html,Asp.net Mvc 4,Razor,Asp.net Web Api,Email Templates,我正在使用ASP.NET WebApi和ASP.NET MVC4,它正在创建一个HTML数据问题,整个HTML没有保存在数据库中,只有一半的数据可以用HTML数据保存 请让我知道是什么问题 //webapi //insert [ValidateModelState] [ValidateJsonAntiForgeryTokenAttribute] public HttpResponseMessage SetEmailTemplate(EmailT
//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>
…非洲人在国外的避风港
你好
EmailTemplatePOCO类的定义是什么?它有MaxLength属性等吗?嗨,没有,它有varchar max属性…Emailtemplatepoco是petapoco的实体。。。我已经和db核对过了,它有varchar(max)。。我可以在调试模式下看到半部分html。。在ajax调用警报中,它显示整个html…但在webapi控制器操作中,我添加了调试点,当时显示了一半html…这是html的问题..或者需要添加一些东西wo webapi方法HI任何人请让我知道这个答案…您是否已将调试放在EmailTemplateModel objEmailTemplateModel上?它显示了一半的html?是的,。。它是在保存数据时显示半个html,我的意思是在webapi控制器方法中显示半个html部分。。。