[英]Javascript returns System.InvalidOperationException: Unexpected new line Error
I'm currently trying to write a mailto form which has the body already created.我目前正在尝试编写一个已经创建正文的 mailto 表单。 For the moment I'm keeping it simple and trying to just put an email, address and name into the body of the email to be sent.
目前,我保持简单,并尝试将电子邮件、地址和姓名放入要发送的电子邮件正文中。 When I do this it returns the error
当我这样做时,它会返回错误
System.InvalidOperationException: Unexpected new line
System.InvalidOperationException:意外的新行
Here's the HTML:这是 HTML:
<form method='post' enctype="text/plain">
<b>Name:</b><br>
<input type="text" name="personsName" id="personsName"><br>
<b>E-mail:</b><br>
<input type="text" name="mail" id ="mail"><br>
<b>Address:</b><br>
<input type="text" name="address" id ="address"><br>
<input type="submit" value="Send" id="send">
</form>
And here's the relevant JavaScript:这是相关的 JavaScript:
$(function(){ EGf20a6658.Init(); });
var EGf20a6658 = {
Init: function() {
if (typeof(OEConfEGf20a6658) === undefined) return;
var allElements = OEConfEGf20a6658;
for(var ID in allElements) {
var $el = $('#'+ID); // The element's main <div> tag
var properties = allElements[ID]; // element's available properties for JS
this.InitElement(ID, $el, properties);
}
},
InitElement: function(ID, $el, properties) {
var name = $('#personsName').val();
var mail = $('#mail').val();
var address = $('#address').val();
var message = "Hey " + " How are you? You still at " + " with the email " + "?";
var mailtolink = 'mailto:me@domain.com?subject=Regret Permission Form&body=' + encodeURIComponent(message);
$( '#send' ).on( 'click', function(event) {
$(this).attr('href', mailtolink);
});
}
};
I noticed that the error always returns the value for name.我注意到错误总是返回 name 的值。
Here's the full error code:这是完整的错误代码:
500 - Unexpected new line: k [CRLF].
System.InvalidOperationException: Unexpected new line: k
[CRLF].
at HttpServer.Tools.StringReader.ReadToEnd(String delimiters)
at HttpServer.Tools.UrlParser.Parse2(ITextReader reader, Boolean urlDecode)
at HttpServer.Tools.UrlParser.Parse2(String queryString, Boolean urlDecode)
at HttpServer.RequestEventArgs.FixPostData(IRequest request)
at HttpServer.RequestEventArgs..ctor(IHttpContext context, IRequest request, IResponse response)
at HttpServer.HttpContext.OnRequest(Object sender, FactoryRequestEventArgs e)
at System.EventHandler`1.Invoke(Object sender, TEventArgs e)
at HttpServer.Messages.MessageFactoryContext.OnMessageComplete(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at HttpServer.Messages.Parser.HttpParser.OnComplete()
at HttpServer.Messages.Parser.HttpParser.GetBody()
at HttpServer.Messages.Parser.HttpParser.Parse(Byte[] buffer, Int32 offset, Int32 count)
at HttpServer.HttpContext.ParseBuffer(Int32 bytesLeft)
at HttpServer.HttpContext.OnReceive(IAsyncResult ar)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.