Browse by Tags
Sorry, but there are no more tags available to filter with.
-
C# 小技巧 - 不必再靠 switch case 副檔名決定 ContentType 囉
-
由 ASP.NET 伺服器端傳回檔案內容,需指定適當的 ContentType,瀏覽器才會將其視為圖檔、HTML、CSS 或 JavaScript 處理。過去我都是土法煉鋼,取得副檔名再用 switch … case 針對已知檔案種類列舉對應 ContentType,像這樣: string contentType = "" ; switch (fileName.Split( '.' ).Last()) { case "jpg" : contentType...