Lm th? no ?: S? d?ng ASP.NET ? b?o v? cc lo?i t?p tin

D?ch tiu ? D?ch tiu ?
ID c?a bi: 815152 - Xem s?n ph?m m bi ny p d?ng vo.
Bung t?t c? | Thu g?n t?t c?

? Trang ny

TM T?T

Bi t?ng b?c ny m t? cch thm b? sung lo?i t?p ? m?t ASP.NET ?ng d?ng ? b?o v? cc lo?i t?p tin nh?t ?nh. Theo m?c ?nh, ASP.NET ?c c?u h?nh ? nh ch?n v ng?ng yu c?u cho m?t s? khc nhau lo?i t?p ?c s? d?ng trong ASP.Cc ?ng d?ng NET. Cc lo?i t?p tin l nh?ng m khng ph?i ?c l?y b?i ng?i dng. Bao g?m cc lo?i t?p tin t?p tin .config lu tr? thng tin c?u h?nh cho ?ng d?ng v .cs t?p tin lu tr? m? ngu?n c?a ?ng d?ng. ASP.NET, ?m b?o s? ring t ny tc ph?m c?a lin k?t m c? hai lo?i t?p tin v?i System.Web.HttpForbiddenHandler. System.web.HttpForbiddenHandler tr? l?i m?t l?i ? s? d?ng yu c?u cc t?p tin. Phng php ny c?a vi?c b?o v? cc t?p tin c th? ?c s? d?ng cho b?t k? lo?i t?p. i?u ny phng php r?t h?u ch ? b?o v? cc t?p tin t?n t?i trong th m?c Web ?ng d?ng v ph?i khng bao gi? ?c l?y b?i ng?i dng.



Ch?nh s?a cc t?p l?nh nh x? trong b? qu?n l? d?ch v? Internet

Microsoft Internet Information Services (IIS) 5.0 s? xc ?nh nh th? no ? x? l? yu c?u d?a trn k?ch b?n ? cho ph?n m? r?ng tn t?p tin c?a theo yu c?u. Nh?ng nh x? k?ch b?n ?c i?u ch?nh b?ng cch s? d?ng d?ch v? Internet Ng?i qu?n l?. Cho ASP.NET ? ch?n cc lo?i t?p tin, tr?c tin b?n ph?i c?u h?nh IIS 5,0 ?n chuy?n ti?p nh?ng yu c?u cho ASP.NET. thc hin vic nay, hay lam theo nhng bc sau:
  1. Vo b?m vo thanh tc v? b?t ?u, i?m ?nThit t, sau b?m Ki?m sot B?ng i?u khi?n.
  2. Nh?p p ? m? cc Quan tri Cng cu th m?c v sau nh?p p ? ch?y D?ch v? Internet Qu?n l?.
  3. Nh?p chu?t ph?i vo my ch? ?o ho?c th m?c ?o m ch?a ASP c?a b?n.NET ?ng d?ng v sau nh?p voThu?c tnh.
  4. Ch?n cc Th m?c chnh ho?c ccTh muc tab. N?u m?t ?ng d?ng ? khng ?c t?o cho cc th m?c ?o, nh?p vo Tao d?i ?ng d?ng Thit t.
  5. D?i Thi?t ?t ?ng d?ng, b?mCu hinh.
  6. ? xc ?nh v? tr Aspnet_isapi.dll t?p tin x? l? ASP.Yu c?u NET, ch?n cc .aspx ?ng d?ng l?p b?n ? sau b?m Ch?nh s?a.
  7. Cc Thm/ch?nh s?a Ti?n ch m? r?ng ?ng d?ng b?n ?h?p tho?i s? xu?t hi?n. Ch?n vn b?n trong cc Tr?nh th?c hi?n l?nh v?c v sau nh?n CTRL + C ? sao chp vn b?n vo Clipboard c?a b?n.
  8. Nh?p vo H?y b? ? tr? v? ccC?u h?nh ?ng d?ng h?p tho?i.
  9. By gi?, thm ?ng d?ng nh x? cho m?i ph?n m? r?ng m b?n mu?n ASP.L?I kh?i. ? lm i?u ny, b?m Thm. Sau , trong ccTr?nh th?c hi?n tr?ng, nh?n CTRL + V ? dn ?ng d?n c?a b?n Aspnet_isapi.dll t?p tin.
  10. Trong cc ?ng t? ph?n, ch?n ccT?t c? cc ?ng t? ty ch?n. Xc minh r?ng cc K?ch b?n ?ng c ch?n h?p ki?m v r?ng cc Ki?m tra n?u t?p tin T?n t?i ki?m tra h?p khng ?c ch?n.
  11. Nh?p vo Ok.
  12. L?p l?i th? t?c ny cho m?i t?p tin tn ph?n m? r?ng m b?n mu?n c x? l? b?i ASP.NET.

C?u h?nh cc lo?i t?p m b?n mu?n ch?n

? ch?n cc lo?i t?p tin b? sung cho m?t ASP.NET ?ng d?ng, h?y lm theo cc b?c sau:
  1. M? t?p tin Web.config trong tr?nh so?n th?o vn b?n nh Notepad. Web.config t?p tin n?m trong th m?c g?c c?a trang Web c?a b?n ?ng d?ng.
  2. Trong t?p tin Web.config thm cc <httphandlers></httphandlers> c?u h?nh ph?n t? d?i cc <system.web></system.web> nguyn t?.

    Chu y B?n ph?i khng sao chp cc <httphandlers></httphandlers> nguyn t? t? t?p tin Machine.config. L? do b?n ph?i khng sao chp cc <httphandlers></httphandlers> Nhm nguyn t? l b?i v? cc <httphandlers></httphandlers> y?u t? cho php b?n thm cc lo?i t?p tin b? sung m khng c?n hon ton ghi thi?t ?t Machine.config.
  3. Trong cc <httphandlers></httphandlers> nguyn t?, s? d?ng <add></add> ti?u th? ? xc ?nh lo?i t?p tin b? sung m b?n mu?n ch?n. ?t cc ?ng t? thu?c tnh b?ng "*". Khi b?n lm i?u ny, b?n ch? ?nh r?ng t?t c? lo?i yu c?u HTTP b? ch?n. Xc ?nh cc ?ng d?n thu?c tnh nh l m?t nhn v?t k? t? ?i di?n ph h?p v?i lo?i t?p b?n mu?n ch?n. V d?, b?n c th? ch? ?nh "*.mdb". Cu?i cng, ?t cc lo?i thu?c tnh cho "System.Web.HttpForbiddenHandler". M?u m? m sau cho th?y lm th? no ? c?u h?nh cc "httpHandlers" ph?n trong Web.config file:
    <system.web>
        <httpHandlers>
            <add verb="*" path="*.mdb" type="System.Web.HttpForbiddenHandler" />
            <add verb="*" path="*.csv" type="System.Web.HttpForbiddenHandler" />
            <add verb="*" path="*.private" type="System.Web.HttpForbiddenHandler" />
        </httpHandlers>
    </system.web>
    
  4. Lu t?p Web.config. ASP.NET application t? ?ng kh?i ?ng l?i.

THAM KH?O

? bi?t thm chi ti?t, b?m vo bi vi?t sau y cc con s? ? xem cc bi vi?t trong c s? ki?n th?c Microsoft:
315736Lm th? no ?: An ton di?n ASP.NET Application b?ng cch s? d?ng Windows b?o m?t
315588 Lm th? no ?: An ton di?n ASP.NET ?ng d?ng b?ng cch s? d?ng gi?y ch?ng nh?n pha khch hng
818014 Lm th? no ?: An ton c?a cc ?ng d?ng ?c xy d?ng trn cc.NET Framework

Thu?c tnh

ID c?a bi: 815152 - L?n xem xt sau cng: 28 Thang Tam 2011 - Xem xt l?i: 2.0
p d?ng
  • Microsoft ASP.NET 1.0
  • Microsoft ASP.NET 1.1
T? kha:
kbacl kbwebservices kbserver kbvalidation kbauthentication kbcode kbwebserver kbconfig kbhowtomaster kbmt KB815152 KbMtvi
My d?ch
QUAN TRONG: Bi vi?t ny ?c d?ch b?ng ph?n m?m d?ch my c?a Microsoft ch? khng ph?i do con ng?i d?ch. Microsoft cung c?p cc bi vi?t do con ng?i d?ch v c? cc bi vi?t do my d?ch ? b?n c th? truy c?p vo t?t c? cc bi vi?t trong C s? Ki?n th?c c?a chng ti b?ng ngn ng? c?a b?n. Tuy nhin, bi vi?t do my d?ch khng ph?i lc no c?ng hon h?o. Lo?i bi vi?t ny c th? ch?a cc sai st v? t? v?ng, c php ho?c ng? php, gi?ng nh m?t ng?i n?c ngoi c th? m?c sai st khi ni ngn ng? c?a b?n. Microsoft khng ch?u trch nhi?m v? b?t k? s? thi?u chnh xc, sai st ho?c thi?t h?i no do vi?c d?ch sai n?i dung ho?c do ho?t ?ng s? d?ng c?a khch hng gy ra. Microsoft c?ng th?ng xuyn c?p nh?t ph?n m?m d?ch my ny.
Nh?p chu?t vo y ? xem b?n ti?ng Anh c?a bi vi?t ny:815152

Cung cp Phan hi

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com