2008-10-24 25 views

Trả lời

6

Để thêm vào loại bậc thầy kịch câm danh sách:

using (DirectoryEntry mimeMap = new DirectoryEntry("IIS://Localhost/MimeMap")) 
{ 
    PropertyValueCollection propValues = mimeMap.Properties["MimeMap"]; 

    IISOle.MimeMapClass newMimeType = new IISOle.MimeMapClass(); 
    newMimeType.Extension = extension; // string - .xap 
    newMimeType.MimeType = mimeType; // string - application/x-silverlight-app 

    propValues.Add(newMimeType); 
    mimeMap.CommitChanges(); 
} 

Thêm một tham chiếu đến:

'System.DirectoryServices' trên tab Thêm tài liệu tham khảo .NET
'Nhà cung cấp không gian tên DNS DS hoạt động' trên tab thêm tài liệu tham khảo COM.

Để cấu hình một loại kịch câm cho một trang web cụ thể, thay đổi ..

'IIS://Localhost/MimeMap'

để

'IIS://Localhost/W3SVC/[iisnumber]/root'

... thay thế '[iisnumber]' với IISNumber của trang web.

Các vấn đề liên quan