31 articles ASP.NET Page 3 / 4

Visual Studio Setting

Setting Visual Studio yang cukup membantu šŸ˜€ A. Menjalankan IIS tanpa men-debug Turning off the new “Enable Edit and Continue” feature fixed it for me. Open Options dialog box (Tools | Options) Locate “Debugging\Edit and Continue” Uncheck “Enable Edit and Continue” http://stackoverflow.com/questions/19568762/how-can-i-prevent-visual-studio-2013-from-closing-my-iis-express-app-when-i-end B. Debug tanpa membuka browser Open your startup project’s properties (Project->{ProjectName} Properties… from…

ASP Read & Write File

[code language=”csharp”] public void ReadFromFile() { string fullPath = System.Web.Hosting.HostingEnvironment.MapPath(FilePath); if (System.IO.File.Exists(fullPath)) { using (StreamReader sr = File.OpenText(fullPath)) { Description = sr.ReadToEnd(); } } } public void SaveToFile() { string fullPath = System.Web.Hosting.HostingEnvironment.MapPath(FilePath); File.WriteAllText(fullPath, Description); //create / overwrite } [/code]

ASP Upload File AJAX using Kendo

File Upload menggunakan setting di Web.config dan MyGlobalMessage.resx. HTML code: [code language=”html”] <input name="files" id="kendo-upload" type="file" /> @Html.HiddenFor(model => model.FilePath) <img id="uploaded-image" src="@(Model.Photo != null ? Url.Content(Model.Photo) : "")" class="img-responsive" alt="" /> [/code] Tambahan di view cshtml [code language=”csharp”] @{ //… string fileTypeErrMsg = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "FileUploadImageTypeError").ToString(); string template = HttpContext.GetGlobalResourceObject("MyGlobalMessage", "FileUploadSizeError").ToString(); string fileSizeErrMsg = string.Format(template,…