Nine MVP's Blog

24/02/2016

C# Language Extension

Filed under: Uncategorized — Nine MVP @ 12:18 pm

แนะนำ library สำหรับเขียน C# ในแนว functional programming

http://blogs.mvcrocks.net/2016/02/csharp-lang-ext/

16/01/2016

update from MvcRocks Blog

Filed under: Uncategorized — Nine MVP @ 6:34 pm

Application Insights เป็นคำตอบ

 

AKKA#1 เมื่อ AKKA มาถึง .NET

 

04/06/2015

Use JSON File as Configuration File

Filed under: C# — Tags: , — Nine MVP @ 1:05 am

แนะนำวิธีการใช้ json file แทนการใช้ app.config/web.config

http://blogs.mvcrocks.net/2015/06/use-json-file-as-configuration-file/

25/05/2015

WEB API: Quota

Filed under: Article, ASP.NET, WEB APIs — Tags: , — Nine MVP @ 2:46 am

แนวคิดเกี่ยวกับการทำ Quota การใช้งานของ API

WEB API: Quota.

Easier way to debug Windows Service project in Visual Studio

Filed under: windows service — Tags: , , — Nine MVP @ 2:43 am

วิธีการ debug windows service บน Visual Studio แบบง่ายๆ

Easier way to debug Windows Service project in Visual Studio.

Visual Studio 2015 RC

Filed under: Visual Studio — Tags: — Nine MVP @ 2:39 am

มี blog ใหม่

Visual Studio 2015 RC.

15/03/2015

my new weblog :)

Filed under: Uncategorized — Nine MVP @ 1:33 pm

ผมย้าย Blog ไปที่   http://blogs.mvcrocks.net แล้วนะครับ 

 

ที่นี่จะเลิกใช้ถาวรครับ

17/04/2014

เอาสิทธิ์ files และ folders คืนมา!!

Filed under: File System, Security — Tags: , , — Nine MVP @ 11:02 pm

วันนี้มีปัญหาเรื่อง 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

Filed under: report tools — Nine MVP @ 11:44 pm

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

Filed under: ASP.NET, ASP.NET MVC, Core System, WEB, Web Security — Nine MVP @ 4:24 pm

เนื่องจากเคยกล่าวไว้ไปหลายรอบในกลุ่ม Facebook เรื่องการปิด Server side information เพื่อความปลอดภัย ลดภาวะเสี่ยงที่จะถูกโจมตีจากช่องโหว่ของ software และ OS เอง

ตัวอย่าง  หลังจากที่ผมได้ยิง request ไปที่ website แห่งนึง ผมลองดู HTTP Header ที่ส่งกลับมาจะพบรายละเอียดดังภาพ

4-5-2014 3-48-28 PM

มาบทความนี้จะช่วยระบุวิธีการปิด HTTP Response Header ที่ส่งออกมาจากฝั่ง Server ไปยัง Client

 

3 ขั้นตอนลับลวงพราง สู่ความปลอดภัยระดับพื้นฐาน

 

1. ลบหรือลวงค่า header X-Powered-By : ASP.NET

ให้ไปแก้ไขใน IIS เปิด website ที่ต้องการมาแก้ไข กดเลือกที่ website ตามรูปด้านล่าง

4-5-2014 3-33-13 PM

4-5-2014 3-35-49 PM

เป็นอันสำเร็จ

 

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  😀

Older Posts »

Blog at WordPress.com.