SELECT *
FROM MyTable
WHERE YEAR(GETDATE()) = YEAR(@SelectDate)
<system.web> <customErrors mode="Off"/> </system.web> <system.webServer> <httpErrors errorMode="Detailed" /> </system.webServer>
[HttpPost]
[ValidateInput(false)]
public ActionResult ValidateInput(string description)
{
ValidateModel validateInputModel = new ValidateModel();
validateInputModel.description = description;
return View(validateInputModel);
}
來源:https://www.codeproject.com/Tips/753483/Validate-Input-in-ASP-NET-MVC
function htmlEscape(str) {
return str
.replace(/&/g, '&')
.replace(/"/g, '"')
.replace(/'/g, ''')
.replace(/</g, '<')
.replace(/>/g, '>');
}
// I needed the opposite function today, so adding here too:
function htmlUnescape(str){
return str
.replace(/"/g, '"')
.replace(/'/g, "'")
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/&/g, '&');
}
$.ajax({
url: '/api/....',
data: { myIDSArray: javascriptArrayOfIDs },
traditional: true,
success: function(result) {
searchResults = result;
}
}).done(function() {
var dataSource = new kendo.data.DataSource({ data: searchResults });
var grid = $('#myKendoGrid').data("kendoGrid");
dataSource.read();
grid.setDataSource(dataSource);
});
public class JsonHttpStatusResult : JsonResult
{
private readonly HttpStatusCode _httpStatus;
public JsonHttpStatusResult(object data, HttpStatusCode httpStatus)
{
Data = data;
_httpStatus = httpStatus;
}
public override void ExecuteResult(ControllerContext context)
{
context.RequestContext.HttpContext.Response.StatusCode = (int)_httpStatus;
base.ExecuteResult(context);
}
}
if(thereWereErrors) { var errorModel = new { error = "There was an error" }; return new JsonHttpStatusResult(errorModel, HttpStatusCode.InternalServerError); }
SET @columnSql = SUBSTRING ( @columnSql , 1 , LEN ( @columnSql ) - 1 )