querystring.cs
来自「这个是个未完成品 演示地址:http://www.yyzyq.com 」· CS 代码 · 共 71 行
CS
71 行
using System;
using System.Data;
using System.Configuration;
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;
/// <summary>
/// 此类主要接受QueryString对象,返回结果
/// </summary>
public class QueryString
{
public QueryString()
{
//
// TODO: 在此处添加构造函数逻辑
//
}
/// <summary>
/// 获取ID
/// </summary>
static public string GetId { get { return (HttpContext.Current.Request.QueryString["id"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["id"]); } }
/// <summary>
/// 获取短信ID
/// </summary>
static public string GetMid { get { return (HttpContext.Current.Request.QueryString["mid"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["mid"]); } }
/// <summary>
/// 获取大类ID
/// </summary>
static public string GetBigId { get { return (HttpContext.Current.Request.QueryString["bigid"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["bigid"]); } }
/// <summary>
/// 获取小类ID
/// </summary>
static public string GetSmallId { get { return (HttpContext.Current.Request.QueryString["smallid"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["smallid"]); } }
/// <summary>
/// 获取主题ID
/// </summary>
static public string GetThemeId { get { return (HttpContext.Current.Request.QueryString["themeid"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["themeid"]); } }
/// <summary>
/// 获取回复ID
/// </summary>
static public string GetBackId { get { return (HttpContext.Current.Request.QueryString["backid"] == null) ? null : vldInput(System.Web.HttpContext.Current.Request.QueryString["backid"]); } }
/// <summary>
/// 获取分页ID
/// </summary>
static public string GetPageId { get { return (HttpContext.Current.Request.QueryString["page"] == null) ? "1" : vldInput(System.Web.HttpContext.Current.Request.QueryString["page"]); } }
static private string vldInput(string strId)
{
try
{
int.Parse(strId);
return strId;
}
catch { HttpContext.Current.Response.Redirect("Default.aspx"); return ""; }
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?