Request 操作类

 

Request

  1 None.gif using  System;
  2 None.gif using  System.Web;
  3 None.gif using  System.Text;
  4 None.gif using  System.Text.RegularExpressions;
  5 None.gif
  6 None.gif namespace  ChinaValue.CommonV2008
  7 ExpandedBlockStart.gifContractedBlock.gif dot.gif {
  8ExpandedSubBlockStart.gifContractedSubBlock.gif    /**//// <summary>
  9InBlock.gif    /// Request操作类
 10ExpandedSubBlockEnd.gif    /// </summary>

 11InBlock.gif    public class CVRequest
 12ExpandedSubBlockStart.gifContractedSubBlock.gif    dot.gif{
 13ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 14InBlock.gif        /// 判断当前页面是否接收到了Post请求
 15InBlock.gif        /// </summary>
 16ExpandedSubBlockEnd.gif        /// <returns>是否接收到了Post请求</returns>

 17InBlock.gif        public static Boolean IsPost()
 18ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 19InBlock.gif            return HttpContext.Current.Request.HttpMethod.Equals("POST");
 20ExpandedSubBlockEnd.gif        }

 21InBlock.gif
 22ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 23InBlock.gif        /// 判断当前页面是否接收到了Get请求
 24InBlock.gif        /// </summary>
 25ExpandedSubBlockEnd.gif        /// <returns>是否接收到了Get请求</returns>

 26InBlock.gif        public static Boolean IsGet()
 27ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 28InBlock.gif            return HttpContext.Current.Request.HttpMethod.Equals("GET");
 29ExpandedSubBlockEnd.gif        }

 30InBlock.gif
 31ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 32InBlock.gif        /// 返回指定的服务器变量信息
 33InBlock.gif        /// </summary>
 34InBlock.gif        /// <param name="strName">服务器变量名</param>
 35ExpandedSubBlockEnd.gif        /// <returns>服务器变量信息</returns>

 36InBlock.gif        public static String GetServerString(string strName)
 37ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 38InBlock.gif            if (HttpContext.Current.Request.ServerVariables[strName] == null)
 39ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 40InBlock.gif                return String.Empty;
 41ExpandedSubBlockEnd.gif            }

 42InBlock.gif
 43InBlock.gif            return HttpContext.Current.Request.ServerVariables[strName].ToString();
 44ExpandedSubBlockEnd.gif        }

 45InBlock.gif
 46ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 47InBlock.gif        /// 返回上一个页面的地址
 48InBlock.gif        /// </summary>
 49ExpandedSubBlockEnd.gif        /// <returns>上一个页面的地址</returns>

 50InBlock.gif        public static String GetUrlReferrer()
 51ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 52InBlock.gif            String retVal = null;
 53InBlock.gif
 54InBlock.gif            try
 55ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 56InBlock.gif                retVal = HttpContext.Current.Request.UrlReferrer.ToString();
 57ExpandedSubBlockEnd.gif            }

 58ExpandedSubBlockStart.gifContractedSubBlock.gif            catch dot.gif{ }
 59InBlock.gif
 60InBlock.gif            if (retVal == null)
 61InBlock.gif                return String.Empty;
 62InBlock.gif
 63InBlock.gif            return retVal;
 64InBlock.gif
 65ExpandedSubBlockEnd.gif        }

 66InBlock.gif
 67ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 68InBlock.gif        /// 得到当前完整主机头
 69InBlock.gif        /// </summary>
 70ExpandedSubBlockEnd.gif        /// <returns></returns>

 71InBlock.gif        public static String GetCurrentFullHost()
 72ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 73InBlock.gif            HttpRequest request = System.Web.HttpContext.Current.Request;
 74InBlock.gif
 75InBlock.gif            if (!request.Url.IsDefaultPort)
 76ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
 77InBlock.gif                return string.Format("{0}:{1}", request.Url.Host, request.Url.Port.ToString());
 78ExpandedSubBlockEnd.gif            }

 79InBlock.gif
 80InBlock.gif            return request.Url.Host;
 81ExpandedSubBlockEnd.gif        }

 82InBlock.gif
 83ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 84InBlock.gif        /// 得到主机头
 85InBlock.gif        /// </summary>
 86ExpandedSubBlockEnd.gif        /// <returns></returns>

 87InBlock.gif        public static String GetHost()
 88ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 89InBlock.gif            return HttpContext.Current.Request.Url.Host;
 90ExpandedSubBlockEnd.gif        }

 91InBlock.gif
 92ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
 93InBlock.gif        /// 获取当前请求的原始 URL(URL 中域信息之后的部分,包括查询字符串(如果存在))
 94InBlock.gif        /// </summary>
 95ExpandedSubBlockEnd.gif        /// <returns>原始 URL</returns>

 96InBlock.gif        public static String GetRawUrl()
 97ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
 98InBlock.gif            return HttpContext.Current.Request.RawUrl;
 99ExpandedSubBlockEnd.gif        }

100InBlock.gif
101ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
102InBlock.gif        /// 判断当前访问是否来自浏览器软件
103InBlock.gif        /// </summary>
104ExpandedSubBlockEnd.gif        /// <returns>当前访问是否来自浏览器软件</returns>

105InBlock.gif        public static Boolean IsBrowserGet()
106ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
107ExpandedSubBlockStart.gifContractedSubBlock.gif            String[] BrowserName = dot.gif"ie""opera""netscape""mozilla" };
108InBlock.gif            String curBrowser = HttpContext.Current.Request.Browser.Type.ToLower();
109InBlock.gif
110InBlock.gif            for (Int32 i = 0; i < BrowserName.Length; i++)
111ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
112InBlock.gif                if (curBrowser.IndexOf(BrowserName[i]) >= 0)
113ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
114InBlock.gif                    return true;
115ExpandedSubBlockEnd.gif                }

116ExpandedSubBlockEnd.gif            }

117InBlock.gif
118InBlock.gif            return false;
119ExpandedSubBlockEnd.gif        }

120InBlock.gif
121ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
122InBlock.gif        /// 判断是否来自搜索引擎链接
123InBlock.gif        /// </summary>
124ExpandedSubBlockEnd.gif        /// <returns>是否来自搜索引擎链接</returns>

125InBlock.gif        public static Boolean IsSearchEnginesGet()
126ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
127ExpandedSubBlockStart.gifContractedSubBlock.gif            String[] SearchEngine = dot.gif"google""yahoo""msn""baidu""sogou""sohu""sina""163""lycos""tom" };
128InBlock.gif            String tmpReferrer = HttpContext.Current.Request.UrlReferrer.ToString().ToLower();
129InBlock.gif
130InBlock.gif            for (int i = 0; i < SearchEngine.Length; i++)
131ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
132InBlock.gif                if (tmpReferrer.IndexOf(SearchEngine[i]) >= 0)
133ExpandedSubBlockStart.gifContractedSubBlock.gif                dot.gif{
134InBlock.gif                    return true;
135ExpandedSubBlockEnd.gif                }

136ExpandedSubBlockEnd.gif            }

137InBlock.gif
138InBlock.gif            return false;
139ExpandedSubBlockEnd.gif        }

140InBlock.gif
141ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
142InBlock.gif        /// 获得当前完整Url地址
143InBlock.gif        /// </summary>
144ExpandedSubBlockEnd.gif        /// <returns>当前完整Url地址</returns>

145InBlock.gif        public static String GetUrl()
146ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
147InBlock.gif            return HttpContext.Current.Request.Url.ToString();
148ExpandedSubBlockEnd.gif        }

149InBlock.gif
150ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
151InBlock.gif        /// 获得指定Url参数的值(过滤SQL注入字符)
152InBlock.gif        /// </summary>
153InBlock.gif        /// <param name="strName">Url参数</param>
154ExpandedSubBlockEnd.gif        /// <returns>Url参数的值</returns>

155InBlock.gif        public static String GetQueryString(String strName)
156ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
157InBlock.gif            return GetQueryString(strName, true);
158ExpandedSubBlockEnd.gif        }

159InBlock.gif
160ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
161InBlock.gif        /// 获得指定Url参数的值
162InBlock.gif        /// </summary>
163InBlock.gif        /// <param name="strName">Url参数</param>
164InBlock.gif        /// <param name="dropInjWords">是否过滤SQL注入字符</param>
165ExpandedSubBlockEnd.gif        /// <returns>Url参数的值</returns>

166InBlock.gif        public static String GetQueryString(String strName, Boolean dropInjWords)
167ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
168InBlock.gif            if (HttpContext.Current.Request.QueryString[strName] == null)
169ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
170InBlock.gif                return String.Empty;
171ExpandedSubBlockEnd.gif            }

172InBlock.gif
173InBlock.gif            String queryStr = HttpContext.Current.Request.QueryString[strName];
174InBlock.gif
175InBlock.gif            if (dropInjWords)
176ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
177InBlock.gif                return DropInjectionWords(queryStr);
178ExpandedSubBlockEnd.gif            }

179InBlock.gif
180InBlock.gif            return queryStr;
181ExpandedSubBlockEnd.gif        }

182InBlock.gif
183ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
184InBlock.gif        /// 过滤SQL注入的字符
185InBlock.gif        /// </summary>
186InBlock.gif        /// <param name="str"></param>
187ExpandedSubBlockEnd.gif        /// <returns></returns>

188InBlock.gif        public static String DropInjectionWords(String str)
189ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
190InBlock.gif            StringBuilder sb = new StringBuilder(str);
191InBlock.gif
192InBlock.gif            sb = sb.Replace(";""");
193InBlock.gif            sb = sb.Replace("'""");
194InBlock.gif
195InBlock.gif            if (Regex.IsMatch(sb.ToString(), @"\s*select\s+"))
196ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
197InBlock.gif                sb = sb.Replace("select""select");
198ExpandedSubBlockEnd.gif            }

199InBlock.gif
200InBlock.gif            if (Regex.IsMatch(sb.ToString(), @"\s*and\s+"))
201ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
202InBlock.gif                sb = sb.Replace("and""and");
203ExpandedSubBlockEnd.gif            }

204InBlock.gif            //sb = sb.Replace("=", "=");
205InBlock.gif
206InBlock.gif            return sb.ToString();
207ExpandedSubBlockEnd.gif        }

208InBlock.gif
209ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
210InBlock.gif        /// 获得当前页面的名称
211InBlock.gif        /// </summary>
212ExpandedSubBlockEnd.gif        /// <returns>当前页面的名称</returns>

213InBlock.gif        public static String GetPageName()
214ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
215InBlock.gif            string[] urlArr = HttpContext.Current.Request.Url.AbsolutePath.Split('/');
216InBlock.gif            return urlArr[urlArr.Length - 1].ToLower();
217ExpandedSubBlockEnd.gif        }

218InBlock.gif
219ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
220InBlock.gif        /// 返回表单或Url参数的总个数
221InBlock.gif        /// </summary>
222ExpandedSubBlockEnd.gif        /// <returns></returns>

223InBlock.gif        public static Int32 GetParamCount()
224ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
225InBlock.gif            return HttpContext.Current.Request.Form.Count + HttpContext.Current.Request.QueryString.Count;
226ExpandedSubBlockEnd.gif        }

227InBlock.gif
228ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
229InBlock.gif        /// 获得指定表单参数的值(过滤SQL注入字符)
230InBlock.gif        /// </summary>
231InBlock.gif        /// <param name="strName">表单参数</param>
232ExpandedSubBlockEnd.gif        /// <returns>表单参数的值</returns>

233InBlock.gif        public static String GetFormString(String strName)
234ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
235InBlock.gif            return GetFormString(strName, true);
236ExpandedSubBlockEnd.gif        }

237InBlock.gif
238ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
239InBlock.gif        /// 获得指定表单参数的值
240InBlock.gif        /// </summary>
241InBlock.gif        /// <param name="strName">表单参数</param>
242InBlock.gif        /// <param name="dropInjWords">是否过滤SQL注入字符</param>
243ExpandedSubBlockEnd.gif        /// <returns>表单参数的值</returns>

244InBlock.gif        public static String GetFormString(String strName, Boolean dropInjWords)
245ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
246InBlock.gif            if (HttpContext.Current.Request.Form[strName] == null)
247ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
248InBlock.gif                return String.Empty;
249ExpandedSubBlockEnd.gif            }

250InBlock.gif
251InBlock.gif            String fromStr = HttpContext.Current.Request.Form[strName];
252InBlock.gif
253InBlock.gif            if (dropInjWords)
254ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
255InBlock.gif                return DropInjectionWords(fromStr);
256ExpandedSubBlockEnd.gif            }

257InBlock.gif
258InBlock.gif            return fromStr;
259ExpandedSubBlockEnd.gif        }

260InBlock.gif
261ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
262InBlock.gif        /// 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值(过滤SQL注入字符)
263InBlock.gif        /// </summary>
264InBlock.gif        /// <param name="strName">参数</param>
265ExpandedSubBlockEnd.gif        /// <returns>Url或表单参数的值</returns>

266InBlock.gif        public static String GetString(String strName)
267ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
268InBlock.gif            if ("".Equals(GetQueryString(strName)))
269ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
270InBlock.gif                return GetFormString(strName);
271ExpandedSubBlockEnd.gif            }

272InBlock.gif            else
273ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
274InBlock.gif                return GetQueryString(strName);
275ExpandedSubBlockEnd.gif            }

276ExpandedSubBlockEnd.gif        }

277InBlock.gif
278ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
279InBlock.gif        /// 获得Url或表单参数的值, 先判断Url参数是否为空字符串, 如为True则返回表单参数的值
280InBlock.gif        /// </summary>
281InBlock.gif        /// <param name="strName">参数</param>
282InBlock.gif        /// <param name="dropInjWords">是否过滤SQL注入字符</param>
283ExpandedSubBlockEnd.gif        /// <returns>Url或表单参数的值</returns>

284InBlock.gif        public static String GetString(String strName, Boolean dropInjWords)
285ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
286InBlock.gif            if ("".Equals(GetQueryString(strName)))
287ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
288InBlock.gif                return GetFormString(strName, dropInjWords);
289ExpandedSubBlockEnd.gif            }

290InBlock.gif            else
291ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
292InBlock.gif                return GetQueryString(strName, dropInjWords);
293ExpandedSubBlockEnd.gif            }

294ExpandedSubBlockEnd.gif        }

295InBlock.gif
296ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
297InBlock.gif        /// 获得指定Url参数的int类型值
298InBlock.gif        /// </summary>
299InBlock.gif        /// <param name="strName">Url参数</param>
300InBlock.gif        /// <param name="defValue">缺省值</param>
301ExpandedSubBlockEnd.gif        /// <returns>Url参数的int类型值</returns>

302InBlock.gif        public static Int32 GetQueryInt(String strName, Int32 defValue)
303ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
304InBlock.gif            return ConvertStr.ToInt32(HttpContext.Current.Request.QueryString[strName], defValue);
305ExpandedSubBlockEnd.gif        }

306InBlock.gif
307ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
308InBlock.gif        /// 获得指定表单参数的int类型值
309InBlock.gif        /// </summary>
310InBlock.gif        /// <param name="strName">表单参数</param>
311InBlock.gif        /// <param name="defValue">缺省值</param>
312ExpandedSubBlockEnd.gif        /// <returns>表单参数的int类型值</returns>

313InBlock.gif        public static Int32 GetFormInt(string strName, int defValue)
314ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
315InBlock.gif            return ConvertStr.ToInt32(HttpContext.Current.Request.Form[strName], defValue);
316ExpandedSubBlockEnd.gif        }

317InBlock.gif
318ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
319InBlock.gif        /// 获得指定Url或表单参数的int类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
320InBlock.gif        /// </summary>
321InBlock.gif        /// <param name="strName">Url或表单参数</param>
322InBlock.gif        /// <param name="defValue">缺省值</param>
323ExpandedSubBlockEnd.gif        /// <returns>Url或表单参数的int类型值</returns>

324InBlock.gif        public static Int32 GetInt(string strName, int defValue)
325ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
326InBlock.gif            if (GetQueryInt(strName, defValue) == defValue)
327ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
328InBlock.gif                return GetFormInt(strName, defValue);
329ExpandedSubBlockEnd.gif            }

330InBlock.gif            else
331ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
332InBlock.gif                return GetQueryInt(strName, defValue);
333ExpandedSubBlockEnd.gif            }

334ExpandedSubBlockEnd.gif        }

335InBlock.gif
336ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
337InBlock.gif        /// 获得指定Url参数的float类型值
338InBlock.gif        /// </summary>
339InBlock.gif        /// <param name="strName">Url参数</param>
340InBlock.gif        /// <param name="defValue">缺省值</param>
341ExpandedSubBlockEnd.gif        /// <returns>Url参数的int类型值</returns>

342InBlock.gif        public static float GetQueryFloat(string strName, float defValue)
343ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
344InBlock.gif            return ConvertStr.ToFloat(HttpContext.Current.Request.QueryString[strName], defValue);
345ExpandedSubBlockEnd.gif        }

346InBlock.gif
347InBlock.gif
348ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
349InBlock.gif        /// 获得指定表单参数的float类型值
350InBlock.gif        /// </summary>
351InBlock.gif        /// <param name="strName">表单参数</param>
352InBlock.gif        /// <param name="defValue">缺省值</param>
353ExpandedSubBlockEnd.gif        /// <returns>表单参数的float类型值</returns>

354InBlock.gif        public static float GetFormFloat(string strName, float defValue)
355ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
356InBlock.gif            return ConvertStr.ToFloat(HttpContext.Current.Request.Form[strName], defValue);
357ExpandedSubBlockEnd.gif        }

358InBlock.gif
359ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
360InBlock.gif        /// 获得指定Url或表单参数的float类型值, 先判断Url参数是否为缺省值, 如为True则返回表单参数的值
361InBlock.gif        /// </summary>
362InBlock.gif        /// <param name="strName">Url或表单参数</param>
363InBlock.gif        /// <param name="defValue">缺省值</param>
364ExpandedSubBlockEnd.gif        /// <returns>Url或表单参数的int类型值</returns>

365InBlock.gif        public static float GetFloat(string strName, float defValue)
366ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
367InBlock.gif            if (GetQueryFloat(strName, defValue) == defValue)
368ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
369InBlock.gif                return GetFormFloat(strName, defValue);
370ExpandedSubBlockEnd.gif            }

371InBlock.gif            else
372ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
373InBlock.gif                return GetQueryFloat(strName, defValue);
374ExpandedSubBlockEnd.gif            }

375ExpandedSubBlockEnd.gif        }

376InBlock.gif
377ExpandedSubBlockStart.gifContractedSubBlock.gif        /**//// <summary>
378InBlock.gif        /// 获得当前页面客户端的IP
379InBlock.gif        /// </summary>
380ExpandedSubBlockEnd.gif        /// <returns>当前页面客户端的IP</returns>

381InBlock.gif        public static String GetIP()
382ExpandedSubBlockStart.gifContractedSubBlock.gif        dot.gif{
383InBlock.gif            String result = String.Empty;
384InBlock.gif
385InBlock.gif            result = HttpContext.Current.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
386InBlock.gif
387InBlock.gif            if (null == result || result == String.Empty)
388ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
389InBlock.gif                result = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"];
390ExpandedSubBlockEnd.gif            }

391InBlock.gif
392InBlock.gif            if (null == result || result == String.Empty)
393ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
394InBlock.gif                result = HttpContext.Current.Request.UserHostAddress;
395ExpandedSubBlockEnd.gif            }

396InBlock.gif
397InBlock.gif            if (null == result || result == String.Empty)
398ExpandedSubBlockStart.gifContractedSubBlock.gif            dot.gif{
399InBlock.gif                return "0.0.0.0";
400ExpandedSubBlockEnd.gif            }

401InBlock.gif
402InBlock.gif            return result;
403ExpandedSubBlockEnd.gif        }

404ExpandedSubBlockEnd.gif    }

405ExpandedBlockEnd.gif}

转载于:https://www.cnblogs.com/guolichun/archive/2008/04/24/1169607.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值