有很多网站的新闻系统是用的.aspx?id=34534我想做成动态的.aspx全部生成为123.aspx,456.aspx,....integer.aspx请问具体怎么写呢?希望能写一下具体的代码
解决方案 »
- 做了个winfrom的应用程序,将exe给其他人报出的错,求高人给看看
- (分享)NET 视频教程源码资料下载
- 如何在asp net 页面上显示带曲线图的excel
- 现有一个做好的大型的web系统,是中文的,现在想实现其它语言如英文等 ,怎么实现多语言支持,用什么方式实现比较好
- config.xml的问题
- 计数,计数,计数!!!求教!!!
- 请问怎样给ascx传值?
- 为什么我的ToolBar在页面什么都不显示
- 花高价寻找一条线索,如何对文本进行编辑。
- 工作流系统是什么样子?
- 请问怎么在DropDownList的item前增加一个多选框来实现多选功能
- 求国家/城市ID(如中国=CN,广东=12985)和语言ID(如简体中文=2052)等对应表
XX.aspx?id=1 -----> 1.htm
XX.aspx?id=n -----> n.htm当访问XX.aspx?id=n 时,把n.htm给他
Dim result As String = ""
Dim MyResponse As System.Net.WebResponse
Dim MyRequest As System.Net.WebRequest
MyRequest = System.Net.HttpWebRequest.Create(sUrl)
MyResponse = MyRequest.GetResponse
Dim MyReader As System.IO.StreamReader = New System.IO.StreamReader(MyResponse.GetResponseStream(), Encoding.Default)
result = MyReader.ReadToEnd
MyReader.Close()
Dim fs As System.IO.FileStream = New System.IO.FileStream(Server.MapPath("\path\..."), IO.FileMode.Create, IO.FileAccess.Write)
Dim wt As System.IO.StreamWriter = New System.IO.StreamWriter(fs, Encoding.Default)
wt.WriteLine(result)
wt.Close()
fs.Close()我不知道怎么用?我想生成全部为 .aspx的,不要.htm的这样设置它的缓冲有效日期呢?如何更新文件呢,真希望谁能写个例子讲解一下
Source.aspx?request=ms --> ms.aspx
Source.aspx?request=system.net --> system.net.aspx............
how to make?,thanks very much,waiting your message.,
我不知道为什么,我这几天上MSDN速度很慢,其他都快,不方便找资料,真心等待大家帮助
/path/123456/default.aspx
/path/test/default.aspx
/path/Microsoft.Net/default.aspx
/path/ms123456/default.aspx
................这些都是一个原理吧,大哥们,请写个例子讲解一下方法和需要调用的对象吧。
去搜,文章很多的。
至于缓存页面,在XXX.aspx页面中加入这么一句
<%@ OutputCache Duration="60" VaryByParam="id" %>
60是缓存时间,VaryByParam是指按参数,如果有多个参数,之间用分号分隔,
如果不考虑参数,整页面缓存,则也要指定VaryByParam, 为"none",因为当xxx.asp传过来后,最终还会转换成XXX.aspx?id=xxx,
所以要在XXX.aspx页面中指定根据id缓存
我明天把代码发上来,太简单不过了,以前都需要写,现在直接用一个头请求转换就OK
Microsoft is great,i love microsoft
run visual web developer 2005
new file,greate class file(vb)source code(test):
Import System
Import System.Web
NameSpace MicrosoftAspx
Public Class TestMsAspx public sub new()
'init
end sub()
implements IhttpHandler
pubic sub ExecuteCode(context as HttpContext) Implements IhttpHandler.ProcessRequest
dim CurrentRequest as string=context.request.rawurl.tostring
'get current request
'set the access dirtory not have file
CurrentReuqest=CurrentReuqest.remove(CurrentRequest.LastIndexOf("."),5)
CurrentRequest=CurrentRequest.remove(0,CurrentRequest.lastIndexOf("/")+1)
CurrentRequest=trim(CurrentRequest)
'intro,you can't write CurrentRequest.trim()
'CurrentRequest.trim<>trim(currentRequest)!!!!
if (CurrentRequest) then
'here access database
'then you can use httprequest remove read data,
context.response.write("test success")
context.response.write("< br />")
context.response.write("you current request keyword value:")
context.response.write(currentRequest)
end if
end sub'must compelte class inteface
public readOnly Property IsReusable() as boolean implements IhttpHandler.IsReusable
get
'not support more
return false
end get
end property
End ClassEnd NameSpace
save the file to site root diretory app_code file or execute vb editor to dll file save to bin folder
step 2 create the web.config save as the same folder..................................
web.config source<configuration><system.web><IhttpHandler><add type="MicrosoftAspx.MsTestAspx" Path="*.aspx" /></IhttpHandler></system.web></configuration>就这样就可以了,不需要设置任何文件,也不需要虚拟写文件,直接转交处理,实际根本连.aspx 的文件都没有,结果处理出来了,搜索是能搜索到的.MS的msdn动态具说大概思路是这样的.文件里面根本没有文件,直接用程序处理,然后就是.config 配置。我在国外的网站上看见的
/news/detail/
像这样的文件名字
/news/detail/123/default.aspx
/news/detail/1234/default.aspx
/news/detail/12345/default.aspx
/news/detail/.../default.aspx
/news/detail/dynamic/default.aspx/news/detail/123.aspx
/news/detail/1234.aspx
............
/news/detail/dynamic.aspx都是一回事,根本不需要缓冲文件,直接空的,用程序转交给 IhttpHandler 处理