• λ我爱Aspx >> Asp.Net >> 使用 HttpContext.RewritePath
  • 使用 HttpContext.RewritePath

  • :未知  Դ:internet  :2007-5-20 16:43:59  ؼ:
  • 使用 HttpContext.RewritePath 来配合 Server.Transfer/Execute

    不少人都懂得在Applicaton_Start等事件中使用HttpContext.RewritePath来改变HttpHandler。

    如果在 Server.Transfer/Execute 的调用前,使用RewritePath,更可以起到指定QueryString的效果。

    例如

    Context.RewritePath("AA.Aspx","","OKOK=3333");

    Context.Server.Transfer("Test2.Aspx");

    这样,就能执行Test2.Aspx,并且QueryString是OKOK=3333。

    这个用途特别大。我目前用这个方法来避免使用 Response.Redirect

    Ҷƪл˵?
  • һƪ使用 HttpContext.RewritePath
    һƪ在类中获取当前页面Page对象的引用