如何從登錄檔讀取檔案的ContentType

2021-05-06 18:29:47 字數 660 閱讀 5368

using

microsoft.win32;

string

filename=@"

c:/11.doc";

system.io.fileinfo fi

=new

system.io.fileinfo(filename);

string

fileextname

=fi.extension;

string

default_content_type ="

";registrykey regkey,fileextkey;

string

filecontenttype;

trycatch

response.clear();

response.addheader(

"content-disposition", 

"inline; filename="+

server.urlencode(filename)); 

response.contenttype

=filecontenttype;

response.writefile(filename); 

經過測試發現,雖然contenttype是正確的,但是例如pdf等檔案還是開啟錯誤,不知道是什麼原因。。。

C 如何讀取登錄檔中的註冊資訊

一 初步認識登錄檔 單擊 開始 執行 在 開啟 的後面填入 regedit 就可以看到登錄檔的資料結構了。如下圖。注 regedit檔案是微軟公司提供給使用者編輯登錄檔的乙個工具。在登錄檔中稱為 主鍵 據圖可見,主鍵 是有層次結構的。主鍵的下一級主鍵稱為該主鍵的 子鍵 每乙個主鍵可以對擁有多個子鍵。...

讀取登錄檔(delphi)

function readreg xbf widestring widestring var xbfconnect string xbfconn1,regconn2,xbfconn3 string tempregbin array 0.15 of char xbflen integer h1 tha...

如何快速建立登錄檔檔案

在解決電腦問題時,我們常常要用到登錄檔檔案。手工編輯登錄檔比較麻煩,比較簡單的辦法是寫好乙個登錄檔檔案 擴充套件名為reg 雙擊就可以匯入了。如何建立這個登錄檔檔案呢?如何匯入登錄檔檔案 雙擊登錄檔檔案,會提示是否匯入登錄檔,選 是 上述方法太麻煩,請看 如何快速建立登錄檔檔案 以建立登錄檔檔案de...