Using System;
Using System. Collections. Generic;
Using System. text;
Using System. Web;
Namespace Pub.mo
{
Public Class Request
{
Private Request (){}
/// <Summary>
/// Get session
/// </Summary>
/// <Param name = "_ session_name"> </param>
/// <Returns> </returns>
Public Static String Session ( String _ Session_name)
{
Object OBJ = httpcontext. Current. session [_ session_name];
Return OBJ = Null ? Config. Empty: obj. tostring ();
}
/// <Summary>
/// GET request. querystring
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Returns> </returns>
Public Static String Querystring ( String _ Str)
{
String S = httpcontext. Current. Request. querystring [_ STR];
Return S = Null ? Config. Empty: S;
}
/// <Summary>
/// GET request. Form
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Returns> </returns>
Public Static String Form ( String _ Str)
{
String S = httpcontext. Current. Request. Form [_ STR];
Return S = Null ? Config. Empty: S;
}
/// <Summary>
/// GET request. Cookies
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Returns> </returns>
Public Static String Cookies ( String _ Str)
{
Httpcookie Hc = httpcontext. Current. Request. Cookies [_ STR];
Return Hc = Null ? Config. Empty: HC. value;
}
/// <Summary>
/// Get the name of the current page
/// </Summary>
/// <Returns> Name of the current page </Returns>
Public Static String Page_name ()
{
String [] Urlarr = httpcontext. Current. Request. url. absolutepath. Split ( ' / ' );
Return Urlarr [urlarr. Length- 1 ]. Tolower ();
}
/// <Summary>
/// Returns the total number of form or URL parameters.
/// </Summary>
/// <Returns> </returns>
Public Static Int Param_count ()
{
Return Httpcontext. Current. Request. Form. Count + httpcontext. Current. Request. querystring. count;
}
/// <Summary>
/// Get all of the request
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Returns> </returns>
Public Static String All ( String _ Str)
{
String S = httpcontext. Current. request [_ STR];
Return S = Null ? Config. Empty: S;
}
# Region Get ID
/// <Summary>
/// The value returned when the url id parameter is not a numerical value is 0 by default.
/// </Summary>
/// <Returns> </returns>
Public Static Int Get_id ()
{
Return Fun. is_id (request. querystring ( " ID " ), 0 );
}
/// <Summary>
/// When the commonly used retrieved ID is not a value, the return value is 0.
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Returns> </returns>
Public Static Int Get_id ( String _ Str)
{
Return Fun. is_id (request. querystring (_ Str ),0 );
}
/// <Summary>
/// Common acquisition ID
/// </Summary>
/// <Param name = "_ Str"> </param>
/// <Param name = "_ return"> Return value if it is not a value </Param>
/// <Returns> </returns>
Public Static Int Get_id ( String _ STR, Int _ Return)
{
Return Fun. is_id (request. querystring (_ Str), _ return );
}
# Endregion
}
}