自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

ASP.NET中aspx頁面

開發(fā) 后端
本文介紹在ASP.NET 2.0中,只需要在web.config里定義你要用的那些namespace,則在aspx頁面中就不需要再象1.1那樣。

看上去這個題目比較長,但實際上,我在看資料時發(fā)現(xiàn),這就是說,在ASP.NET 2.0中,只需要在web.config里定義你要用的那些namespace,則在aspx頁面中就不需要再象1.1那樣,用< %@ import namespace="system.text" %>來引用了。

比如,只需要在web.config中,以這樣的方式就可以了

  1. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
  2. <system.web> 
  3. <pages> 
  4. <namespaces> 
  5. <add namespace ="System.IO" /> 
  6. <add namespace="System.Text"/> 
  7. </namespaces> 
  8. </pages> 
  9. </configuration> 
  10. </system.web> 

這樣一來,在所有的aspx頁面中(注意不是codebehind頁面),則不需要再用import的方法引入了.

同樣道理,在ASP.NET 1.1中,自定義控件的引用,在aspx頁面中也是很麻煩的,在ASP.NET 2.0中,可以在web.config中這樣定義

  1. <configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0"> 
  2. <system.web> 
  3. <pages> 
  4. <namespaces> 
  5. <add namespace ="System.IO" /> 
  6. <add namespace="System.Text"/> 
  7. </namespaces> 
  8. <controls> 
  9. <add tagPrefix="uc" namespace="xx" 
  10. assembly="xxxx" /> 
  11. </controls> 
  12. </pages> 
  13. </configuration> 
  14. </system.web> 

【編輯推薦】

  1. ASP.NET的TypeConverter
  2. 淺析ASP.NET的TypeResolver
  3. ASP.NET中定義JavaScriptConverter
  4. 在ASP.NET中替換Sys.Services的方法
  5. 使用ASP.NET AJAX的Profile Service
責(zé)任編輯:佚名 來源: IT專家網(wǎng)
點贊
收藏

51CTO技術(shù)棧公眾號