我试图提交表单的处理程序页面,但现在没有什么工作,它甚至不打...处理器提交表单到处理器不工作
这里是我的代码:
<form action="Unsubscription.ashx?actionmethod=subscribe" method="get" >
<div class="h1">
<input type="text" class="input" value="enter your e-mail" name="ekey" />
<input type="submit" value="Submit" />
</div>
</form>
处理代码:
public void ProcessRequest(HttpContext context)
{
try
{
string email = context.Request.Params["ekey"];
switch (context.Request.Params["actionmethod"])
{
case "subscribe":
NewsLetter.Subscribe(email);
break;
case "unsubscribe":
NewsLetter.Unsubscribe(email);
context.Response.ContentType = "text/html";
context.Response.Write("your subscription has been successfully canceled. thanks.<br/><a href='http://www.kayatax.com'><b>home page</b></a>");
break;
}
}
catch {
context.Response.ContentType = "text/html";
context.Response.Write("This e-mail doesn't exist in our database. Thanks.<br/><a href='http://www.kayatax.com'><b>Home Page</b></a>");
}
}
好的,我改变了它,但现在我无法看到渲染后的表单元素。我不知道为什么,也不是很有趣。 Firebug不显示提交按钮周围的表单元素。 – Tarik 2009-10-13 01:16:36
关闭表格标签,如“”中所述。请注意斜杠。你刚刚把另一个开放“
(facepalm)...... – CRice 2009-10-13 01:27:43