asp.net实现phpcms模板功能初步研究
栏目:综合技术时间:2014-06-20 21:31:28
通过这个函数输出一个模块的前台显示。 using System;
using System.Collections.Generic;
using System.Text;
namespace YD.Common.CMS
{
public class LoginModel
{
public static string printLogin()
{
StringBuilder sb = new StringBuilder();
sb.Append("<form method=post>");
sb.Append(" <div class='loginCss'>");
sb.Append(" <input type=text value=ok name=login_name />");
sb.Append(" <input type=submit value=ok /></div></form>");
return sb.ToString();
}
}
}
前台调用这个函数: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>用户登录模块</title>
</head>
<body>
<div>
<%=YD.Common.CMS.LoginModel.printLogin() %>
</div>
</body>
</html>
asp.net实现的传统form提交: using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["login_name"] != null)
Response.Write(Request.Form["login_name"].ToString());
}
}
------分隔线----------------------------
------分隔线----------------------------