解决方案 »
- 请教大师,StringBuilder Append string的方法,报错,应该怎么办呢
- 自动登录网站,急!
- 如何用 page.ClientScript的方法或者其他方法把JS脚本注册到 body和from之间
- 为什么单步执行一定要设断点才能做啊
- js里function函数里怎样传递数组??(.net 3.5)
- String和string到底用哪个好?
- 如何用Js遍历dataGrid中模板列的checkbox 是否被选中!高手帮忙一下!!!!
- rocklabzhang进来拿分
- 技术难题,紧急求助,在线等待,请高手勿必帮帮忙!!!
- 采鸟问题:用asp.net开发网站,页面制作问题,在线等待!!
- ASP.NET中GridView的问题
- 使用母版页的页面回发后,GridView控件中的数据都没有了,怎样才能保持住GridView中的数据呢?
if(url.Contains(".aspx"))
newUrl =url.Replace(".aspx",".html"); //将aspx后缀转换为html后缀,实现伪静态。
else
newUrl=url;
目录设置默认文档或context.writepath
想把网页伪装成目录的形式.比如http://video.sina.com.cn/movie/detail/zhb这样的地址.或是想转成http://test.xiaoyangstudio.com/do.dll这样的地址..
我的技术主管用了个方法.可以使用类似于
http://www.feiku.com/do.dll?n=GetCurrentUser&t=Cnaws.Web.Sites,Cnaws.Web
这样的链接去请求一个AJAX回应..
我也想实用这样的效果.
昨天使用了这样的方法private void application_BeginRequest(object sender, EventArgs e) {
//重写URL
HttpContext context = (sender as HttpApplication).Context;
string FullURL = context.Request.Url.ToString();
if (FullURL.Contains("/run.dll?")) {
context.Response.End();
}
}
public void application_EndRequest(object sender, EventArgs e) {
HttpApplication application = sender as HttpApplication;
HttpContext context = application.Context;
HttpResponse response = context.Response;
if (context.Request.Url.ToString().Contains("/run.dll?")) {
string className = context.Request.QueryString["in"];
string functionName = context.Request.QueryString["run"];
//context.Response.Write("命名空间:" + className + ",函数名:" + functionName);
string[] paraName = context.Request.Form.AllKeys ;
//context.Response.Write("参数名:" + paraName + ",值" + paraValue);
//context.Response.Write("\n\r");
try {
Type tp = Type.GetType(className, false, true);
MethodInfo ma = tp.GetMethod(functionName);
string[] inParam = new string[ma.GetParameters().Length];
int ParamIndex = 0;
foreach (ParameterInfo param in ma.GetParameters()) {
for (int i = 0; i < paraName.Length; i++) {
if (paraName[i] == param.Name) {
inParam[ParamIndex] = context.Request.Form[i];
ParamIndex++;
}
}
}
context.Response.Write(ma.Invoke(null, inParam).ToString());
} catch(Exception ex) {
context.Response.Clear();
context.Response.Write(ex.ToString());
}
}
}
在windows2003+vs2008+IIS6.0的情况下是可行.
但是回到家又不行了..而且传上我的空间也不行..我估计这个问题和我上面的问题的原因是一样的..
XP的IIS5里没有IIS6那样的设置...
是不是默认只能接管.aspx和.html 一定要装了IIS6才可以接受非.aspx和.html的URL请求.?