会员
周边
众包
新闻
博问
闪存
所有博客
当前博客
我的博客
我的园子
账号设置
简洁模式
...
退出登录
注册
登录
种玉堂
今天能做的事,不要拖到明天去做
博客园
首页
联系
订阅
管理
读取常用数据(1)读取Web.config,QueryString和Form(Post)
又几个毫无技术含量的函数,记录一下。呵呵
using
System;
using
System.Web;
using
System.Configuration;
//
读取web.config
namespace
QS_Web
{
namespace
Kobold
{
public
class
Read
{
public
static
string
GetConfigSetting(
string
strKeyName)
//
读取Web.config文件设置字符串
{
string
str;
try
{
str
=
ConfigurationSettings.AppSettings[strKeyName];
//
读取
}
catch
{
str
=
"
null
"
;
}
if
(str
==
null
||
str
==
String.Empty)
{
return
"
null
"
;
}
else
{
return
str;
}
}
public
static
string
GetQueryString(
string
strParameterName)
//
获取Url Query String
{
string
str;
try
{
if
(HttpContext.Current.Request.QueryString[strParameterName]
!=
null
)
{
str
=
HttpContext.Current.Request.QueryString[strParameterName];
}
else
{
str
=
"
null
"
;
}
}
catch
{
str
=
"
error
"
;
}
return
str;
}
public
static
string
GetForm(
string
strName)
//
获取 post Form
{
string
str;
try
{
if
(HttpContext.Current.Request.Form[strName]
!=
null
)
{
str
=
HttpContext.Current.Request.Form[strName];
}
else
{
str
=
"
null
"
;
}
}
catch
{
str
=
"
error
"
;
}
return
str;
}
}
}
}
posted @
2006-08-03 15:22
KenBlove
阅读(
343
) 评论(
0
)
编辑
收藏
举报
会员力量,点亮园子希望
刷新页面
返回顶部
公告