易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET Routing for URLRewriting with QueryStrings

In the last post I showed how to use the ASP.NET 3.5 Routing Engine
for URLRewriting purposes. I want to go further in this post by adding
the ability to add variables into a route path and forward and append
query string variables to the destination Web Form request.
A route can contain one or more variables expressed by its {name}.
 
RouteTable.Routes.Add(
new
Route(
"articles/{id}"
,
new
devcoach.Web.RoutingPageHandler()));
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
Inside of the RoutingHandler we can iterate through the variables by
accessing them by the RouteData property on the parameter passing the
RequestContext:
var queryString = new
StringBuilder("?"
);
foreach
(var aux in
requestContext.RouteData.Values)
{
queryString.Append(
requestContext.HttpContext.Server.UrlEncode(aux.Key));
queryString.Append("="
);
queryString.Append(
requestContext.HttpContext.Server.UrlEncode(
aux.Value.ToString()));
queryString.Append("&"
);
}
queryString.Remove(queryString.Length - 1, 1);
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0e


相关文档:

asp.net browse for folder

System.Windows.Forms;
FolderBrowserDialog 提供了我们需要的文件夹浏览对话框,因为是COM必须是STA的,设置 AspCompat="true"来解决这个问题。
用法:
    protected void Button1_Click(object sender, EventArgs e)
    {
 
         ......

asp.net跳转页面的三种方法比较

1、 response.redirect 这个跳转页面的方法跳转的速度不快,因为它要走2个来回(2次postback),但他可以跳 转到任何页面,没有站点页面限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。但速度慢是其最大缺陷!redirect跳转机制:首先是发送一个http请求到客户端,通知需要跳转到新页面,然后客户端在发送跳转请求到服务器 ......

asp.net连接mysql数据库

Mysql的connector/net5.0下载地址:
http://dev.mysql.com/get/Downloads/Connector-Net/mysql-connector-net-5.0.6.zip/from/pick
安装好以后,
点属性,然后点查找目标,点向上一层目录,找到Binaries\.NET 2.0,然后将这个文件复制到你的工程目录下,一般这样的DLL文件会保存到bin目录下.
在代码页里输入using Mysql.Da ......

asp.net运行原理


 
主要类:
  System.Web.HttpRuntime
  System.Web.HttpApplicationFactory
  System.Web.HttpApplication
  System.Web.Compilation.BuildManager
  System.Web.Compilation.ApplicationBuildProvider
  System.Web.Compilation.BuildProvidersCompiler
  System.Web.UI.PageHandlerFactory ......

ASP.NET程序中常用的三十三种代码


1. 打开新的窗口并传送参数: 
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryStrin ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号