แนะนำ library สำหรับเขียน C# ในแนว functional programming
24/02/2016
16/01/2016
update from MvcRocks Blog
Application Insights เป็นคำตอบ
AKKA#1 เมื่อ AKKA มาถึง .NET
04/06/2015
Use JSON File as Configuration File
แนะนำวิธีการใช้ json file แทนการใช้ app.config/web.config
http://blogs.mvcrocks.net/2015/06/use-json-file-as-configuration-file/
25/05/2015
Easier way to debug Windows Service project in Visual Studio
วิธีการ debug windows service บน Visual Studio แบบง่ายๆ
Easier way to debug Windows Service project in Visual Studio.
15/03/2015
17/04/2014
เอาสิทธิ์ files และ folders คืนมา!!
วันนี้มีปัญหาเรื่อง permission ใน folder website หายไป ด้วยความผิดพลาดบางอย่าง มันได้ปลดสิทธิ์ของ files / folders ออกทั้งหมดทั้ง Administrators, IIS User, etc เกือบหมดเกลี้ยง เกิด error Access Denied ตลอดเวลา
จา่กนั้นได้ทดลองทำการ add permission กลับมาด้วย Windows UI โดยเลือก Folder -> Right click -> Properties แล้วไปที่ Security Tab จากนั้นก็กด Add User / Group กลับมา
ขณะที่ Windows กำลัง add permission ที่กำหนดผ่าน UI ไป ปรากฎว่าบาง File ก็ยังไม่สามารถนำกลับมาได้ ฟ้อง Access Denied ขึ้นมาจำนวนมาก เริ่มเอามือกุมขมับ
จากนั้นไปดู script ที่เป็นปัญหา มีการใช้คำสั่ง cacls ในการเพิ่ม user เข้ามาจึงคิดว่าน่าจะมี switch option ที่ช่วยแก้ปัญหานี้ได้ link CACLS
หลังจากอ่านการทำงานพอเข้าใจ ก็เลยต้องยอมให้ทุกคนเข้ามาจัดการกับ Files/Folders นี้ได้ในขั้นต้น แล้วค่อยปลดออกทีหลัง
icacls D:\folder /t /c /grant Everyone:F
หลังจากนั้นก็ค่อย grant user/group ตาม permission เก่ากลับเข้าไป
ทุกอย่างจึงกลับมาทำงานได้ปกติเหมือนเดิม T__T
08/04/2014
Crystal Reports SP9 for Visual Studio 2013
Crystal Reports ออก SP9 รองรับ Visual Studio 2013 แล้วครับ
SAP Crystal Reports, developer version for Microsoft Visual Studio – Service Pack 9 – Fixed Issues and updates
New In This Release
Added support for following platforms:
1. Visual Studio 2013!
2. .NET 4.5.1
3. Data Sources: SQL Server 2014 (tested CTP2), Oracle 12c, HANA SP7
4. Web Browser: Safari 7
release notes http://scn.sap.com/docs/DOC-7824
download http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_9.exe
05/04/2014
Secure Server Side Information
เนื่องจากเคยกล่าวไว้ไปหลายรอบในกลุ่ม Facebook เรื่องการปิด Server side information เพื่อความปลอดภัย ลดภาวะเสี่ยงที่จะถูกโจมตีจากช่องโหว่ของ software และ OS เอง
ตัวอย่าง หลังจากที่ผมได้ยิง request ไปที่ website แห่งนึง ผมลองดู HTTP Header ที่ส่งกลับมาจะพบรายละเอียดดังภาพ
มาบทความนี้จะช่วยระบุวิธีการปิด HTTP Response Header ที่ส่งออกมาจากฝั่ง Server ไปยัง Client
3 ขั้นตอนลับลวงพราง สู่ความปลอดภัยระดับพื้นฐาน
1. ลบหรือลวงค่า header X-Powered-By : ASP.NET
ให้ไปแก้ไขใน IIS เปิด website ที่ต้องการมาแก้ไข กดเลือกที่ website ตามรูปด้านล่าง
เป็นอันสำเร็จ
2. ลบหรือลวงค่า header Server : Microsoft-IIS/8.0 และ X-AspNet-Version : 4.0.xxxx
สร้าง class ขึ้นมาตัวนึง แล้ว inherit IHttpModule Interface เพื่อลบหรือแก้ไขค่าของ Server header
public class SecureInfoModule : IHttpModule
{
public void Init(HttpApplication context)
{
context.PreSendRequestHeaders += OnPreSendRequestHeaders;
}
public void Dispose() { }
void OnPreSendRequestHeaders(object sender, EventArgs e)
{
HttpContext.Current.Response.Headers.Set("Server", "I don't know ..."); //ใส่ข้อความถึง hacker
}
}
ต่อจากนั้นนำ module ที่สร้างไว้มา register ลงใน webserver tag
ให้เปิด Web.Config มาแก้ไขกำหนดสั่งปิดการแสดงผล version ของ http runtime
<system.web>
<httpRuntime enableVersionHeader="false"/> .... </systen.web> นำ class module ที่สร้างไว้ มาใส่ใน webServer tag <system.webServer> <modules> <add name="SecureInfoModule" type="ใส่ namespace ให้ตรง.SecureInfoModule" /> ......... </modules> </system.webServer>
3. ลบหรือลวงค่า X-AspNetMvc-Version : 4.0
เปิดโปรเจ็คใน Visual Studio มองหา Global.asax.cs เปิดมาใส่โค้ด
protected void Application_Start() { MvcHandler.DisableMvcResponseHeader = true; ..... }
หวังว่าจะเป็นประโยชน์สำหรับเหล่าสาวก .NET 😀
You must be logged in to post a comment.