asp.net2.0 URL重寫(xiě)以及urlMappings問(wèn)題(1)(2)_.Net教程

      編輯Tag賺U幣
      教程Tag:暫無(wú)Tag,歡迎添加,賺取U幣!

      推薦:談?wù)凥tmlControl與WebControl的區(qū)別與用途
      Web控件和Html控件雖然好多功能相同并且長(zhǎng)得很像 但是它們的內(nèi)部實(shí)現(xiàn)機(jī)制是完全不一樣的 Web控件要比Html控件執(zhí)行效率要好 1. 使用起來(lái)也相當(dāng)方便,舉個(gè)簡(jiǎn)單的例子,例如Button

      void IHttpModule.Init(HttpApplication context)
      {
      context.BeginRequest = delegate(object sender, EventArgs e)
      {
      System.Web.HttpContext cxt = context.Context;

      if (cxt.Request.ContentType != "image/pjpeg")
      {
      string type = cxt.Request.ContentType.ToLower();
      string path = cxt.Request.Path;
      string apppath = cxt.Request.ApplicationPath;
      path = path.Remove(0, apppath.Length);
      path = "~" path;

      string newUrl = GetUrl(cxt, path.TrimEnd().TrimStart());
      if (newUrl != null)
      {
      cxt.Response.Filter = new ResponseFilter(cxt.Response.Filter, cxt.Request.Path);
      cxt.Response.Write("請(qǐng)求的路徑:" path);
      cxt.Response.Write("");
      cxt.Response.Write("轉(zhuǎn)向的目的URL:" newUrl);
      cxt.Response.Write("");
      cxt.RewritePath(newUrl);
      }
      //如果要求處理所有的請(qǐng)求時(shí)用到
      //else
      //{
      // cxt.Response.Write(cxt.Request.Path "");
      // cxt.Response.Write("你請(qǐng)求的資源不存在或無(wú)權(quán)訪問(wèn)!");
      // cxt.Response.Flush();
      // cxt.Response.End();
      //}
      }
      };
      }
      }

      分享:ASP.NET 2.0服務(wù)器控件之客戶端功能
        多數(shù)在表示層應(yīng)用的服務(wù)器控件主要由兩個(gè)部分組成:服務(wù)器端功能和客戶端功能。服務(wù)器端功能永遠(yuǎn)是服務(wù)器控件的核心,而隨著技術(shù)的發(fā)展,客戶端功能也逐漸變得越來(lái)越重要。只有兩個(gè)部分

      共2頁(yè)上一頁(yè)12下一頁(yè)
      來(lái)源:模板無(wú)憂//所屬分類(lèi):.Net教程/更新時(shí)間:2008-08-22
      相關(guān).Net教程