วันอังคารที่ 24 มีนาคม พ.ศ. 2558

Linq OrderBy Extension

ในการพัฒนาโปรแกรม ด้วย ASP.net ต้องมีการQuery ข้อมูลมาแสดงในGridView ซึ่งต้องมีส่วนของการ Sort Data แน่นอน และถ้าเราใช้ LinQ ละ? ผมจึงนำ Extension Method ใน LinQ นำมาฝาก
รูปแบบการเรียกใช้งานทำได้ดังนี้


list.OrderBy("SomeProperty");
list.OrderBy("SomeProperty DESC");
list.OrderBy("SomeProperty DESC, SomeOtherProperty");
list.OrderBy("SomeSubObject.SomeProperty ASC, SomeOtherProperty DESC");

 ที่มา
Dynamic SQL-like Linq OrderBy Extension
http://aonnull.blogspot.com/2010/08/dynamic-sql-like-linq-orderby-extension.html


C#.net Convert To VB.net By :http://converter.telerik.com/


View Code

วันจันทร์ที่ 6 ตุลาคม พ.ศ. 2557

Prevent Remember My Password , Disable Remember My Password on brower

ในหน้าเว็บที่ต้องกรอก UserName & Password เมื่อทำการ submit แล้ว Brower จะถามว่าต้องการบันทึกหรือไม่
      เมื่อเราทำการกด บันทึกBrower ก็จะจำuser และ รหัสผ่านที่เรากรอกไป
ซึ่งทำให้ผู้ที่เข้ามาเปิดเว็บคนถัดไปสามารถใช้ ข้อมูลที่เก็บไว้ในที่นี้ log in เข้าไปได้

วิธีการป้องการ การจำในส่วนนี้ ทำได้ดังนี้
(Disable Remember My Password)
เพิ่ม tag
              <div style=" visibility:hidden; width:0px; height:0px;">
                    <input id="txtpus"  type="text" />
                    <input id="txtusper" type="password" />
                </div>



วันศุกร์ที่ 14 มีนาคม พ.ศ. 2557

How to disable filemonitoring on IIS using c# code

add code in Global Event Application Start


View Code

ที่มา :-  http://www.narisa.com/forums/index.php?showtopic=27585

- http://stackoverflow.com/questions/3610240/how-to-disable-filemonitoring-on-iis-using-c-sharp-code
- http://www.ruxcom.com/aspnet-session-lost

วันอังคารที่ 30 กรกฎาคม พ.ศ. 2556

วันพุธที่ 20 มิถุนายน พ.ศ. 2555

เรื่องของ การGetUser


'***********
Function getuser()
Response.Buffer = True :  Response.Clear
IF (Len(Request.ServerVariables("LOGON_USER")) <> 0 ) then
strLogon = Right(Request.ServerVariables("LOGON_USER"),Len(Request.ServerVariables("LOGON_USER"))-InStr(Request.ServerVariables("LOGON_USER"),"\"))
response.Write uCase(strLogon)

Else
Response.Status = "401 Unauthorized"
Response.Write("System.UnauthorizedAccess Exception: Error Access is denied.")&"<br>"
response.write Response.Status
response.End()
End IF
End Function

http://www.mail-archive.com/activeserverpages@list.15seconds.com/msg00493.html

ดูราคาทองคำกันหน่อยเนอะ

วันพฤหัสบดีที่ 14 มิถุนายน พ.ศ. 2555

ติดตั้ง IIS 7 Windows 7

ขอนำเสนอการติดตั้ง IIS 7 บน windows 7 แบบ step by step
1.Start >>control Panel >>Programs and Features
2.เลือกเมนู Turn Windows features on or off ทางฝั่งซ้ายมือ จะมีหน้าต่างขึ้นมา
3.set ในส่วนของ Internet Information Services ตามรูปด้านล้างเลยคับ แล้วกดปุ่ม ok
หายเหตุ: ไม่ต้องเลือก IIS 6 Management Console นะครับ ในรูปผิด
4. หลังจากนั้นระบบจะดำเนินการติดตั้ง IIS7 ให้
5. ทดสอบรัน webservice โดยเปิด IE แล้วพิมพ์  http://localhost/ แล้วกด enter จะได้ดังรูป

หากต้องการให้เพื่อนคุณเข้ามาใช้เว็บในเครื่องผ่าน IPAddress ก็สามารถทำได้ โดยเปิด IE แล้วพิมพ์  http://IPAddress/ แล้วกด enter [เช่น http://192.168.0.15/] ก็จะขึ้นเหมือนกัน 
หากเครื่องคุณทำการปิด Firewall ไว้ เครื่องอื่นอาจจะเข้าไม่ได้ให้ทำการปิดหรือ เปิดสิทธิ์ให้เข้าถึงได้ก่อนครับ