UWInfo Blog
發表新文章
[Join] | [忘記密碼] | [Login]
搜尋

搜尋意見
文章分類-darren
[所有文章分類]
  • ASP.NET (24)
  • ASP.NET2.0 (4)
  • ASP.NET4.0 (13)
  • JavaScript (17)
  • jQuery (5)
  • FireFox (2)
  • UW系統設定 (2)
  • SQL (7)
  • SQL 2008 (3)
  • mirror (0)
  • SVN (2)
  • IE (3)
  • IIS (6)
  • IIS6 (0)
  • 閒聊 (1)
  • W3C (4)
  • 作業系統 (3)
  • C# (14)
  • CSS (0)
  • FileServer (0)
  • HTML 5 (7)
  • CKEditor (0)
  • UW.dll (9)
  • Visual Studio (2)
  • Browser (2)
  • SEO (0)
  • Google Apps (1)
  • 網站輔助系統 (1)
  • DNS (0)
  • SMTP (3)
  • 網管 (5)
  • 社群API (3)
  • SSL (1)
  • App_Inventor (0)
  • URLRewrite (1)
  • 開發工具 (2)
  • JSON (0)
  • Excel2007 (0)
  • 試題 (0)
  • LINQ (0)
  • bootstrap (0)
  • Vue (0)
  • IIS7 (2)
  • foodpanda (0)
  • 編碼 (0)
  • 資安 (3)
  • Sourcetree (0)
  • MAUI (0)
  • CMD (0)
  • my sql (1)
所有文章分類
[darren的分類]
  • ASP.NET (48)
  • ASP.NET2.0 (15)
  • ASP.NET4.0 (34)
  • JavaScript (49)
  • jQuery (26)
  • FireFox (4)
  • UW系統設定 (3)
  • SQL (39)
  • SQL 2008 (25)
  • mirror (4)
  • SVN (4)
  • IE (9)
  • IIS (20)
  • IIS6 (1)
  • 閒聊 (7)
  • W3C (6)
  • 作業系統 (9)
  • C# (24)
  • CSS (12)
  • FileServer (1)
  • HTML 5 (11)
  • CKEditor (3)
  • UW.dll (13)
  • Visual Studio (16)
  • Browser (8)
  • SEO (1)
  • Google Apps (3)
  • 網站輔助系統 (4)
  • DNS (5)
  • SMTP (4)
  • 網管 (11)
  • 社群API (3)
  • SSL (4)
  • App_Inventor (1)
  • URLRewrite (2)
  • 開發工具 (6)
  • JSON (1)
  • Excel2007 (1)
  • 試題 (3)
  • LINQ (1)
  • bootstrap (0)
  • Vue (3)
  • IIS7 (3)
  • foodpanda (2)
  • 編碼 (2)
  • 資安 (3)
  • Sourcetree (1)
  • MAUI (1)
  • CMD (1)
  • my sql (1)
最新回應
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • UW DB 元件罕見的錯誤
    我之前好像也遇過, 考慮改一下 pg 的程式....more
  • UW DB物件 GetAllDataFromBaseTableWithCache 會嚴重影響效能
    我把它拿掉了....more
  • UW DB物件 GetAllDataFromBaseTableWithCache 會嚴重影響效能
    好, 把它拿掉.....more
  • 使用 facebook JS SDK 的心得筆記
    FB.login 沒有任何反應~ 不知道怎解決...more
  • IIS Server SSL 升級方式
    更新一版 reg 可以變 A...more
  • 防止 event 往上傳的終極方法
    eee...more
  • IIS Server SSL 升級方式
    Cool......more
  • UNT流量異常追蹤紀實
    有做 Request 的來源 IP 分析嗎 ? 說不定會有其它的發現.....more
  • facebook 網頁分享 Debug 模式
    Header 裡面的兩個 tag.. <meta property="og:i...more
標籤
  • unt
  • window
  • 匯出
  • -8768
  • mssql 備份
  • 7527
  • vs
  • ctrl
  • -8739 UNIO
  • StreamRead
  • net
  • 398
  • [U2]
  • Async
  • firefox
  • 766
  • 782
  • for
  • 15
  • TPBase
  • blog
  • 54
  • url,
  • 2873
  • ad
  • ef
  • [t]
  • 954
  • mod[t]
  • udlgiichdd
  • web
  • GN
  • CK
  • 516
  • IE
  • DB備份
  • 網站
  • aspx
  • wget
  • expr 91048
  • 72
  • -5959 UNIO
  • active
  • ashx
  • -8773 AvZl
  • -5772 UNIO
  • IndexOf
  • gDcfE3Zp
  • 擴充套件
  • sqldepende
頁數 1 / 2 下一頁
搜尋 結果:
IP v4 Country 取得IP所屬國家
其實是 2024/10 取得的IP country 檔案
相關檔案以及程式碼放在附件
More...
darren, 2025/1/23 上午 09:40:06
Html to PDF
找了一下相關工具,發現這個還不錯
http://selectpdf.com/community-edition/

免費的
這是給開發社群的,基本功能有,但是限制是只能產生 5 頁的 PDF
但5頁限制用於產生帳單,出貨單已經很夠用了
附上 .net40  的元件
 
More...
darren, 2016/3/4 下午 12:28:46
System.Web.CachedPathData.ValidatePath Exception
錯誤訊息如下, 完全沒有錯誤訊息, 以及沒有錯誤的程式碼位置
 <Item time="2016-01-11T05:39:01" page="/fr/iconic-bright-cushion-spf-50-pa-nude-perfection-compact-foundation/p/5490/c/30"
url="http://www.shopunt.com/fr/iconic-bright-cushion-spf-50-pa-nude-perfection-compact-foundation/p/5490/c/30?utm_source=edm&amp;utm_medium=email&amp;utm_content=20160107_cushion_4&amp;utm_campaign=makeup&amp;OutAD_Id=5825" username="Not Member" browserName="Chrome" browserVersion="34.0" userAgent="Mozilla/5.0 (Linux; Android 5.1.1; SAMSUNG SM-N915FY Build/LMY47X) AppleWebKit/537.36 (KHTML, like Gecko) SamsungBrowser/2.1 Chrome/34.0.1847.76 Mobile Safari/537.36" RemoteIP="37.160.206.7" Ref="No Ref" RequestType="GET" Ver="3">
    <ErrMsg>
    </ErrMsg>
    <ErrStack> 於 System.Web.CachedPathData.ValidatePath(String physicalPath)
於 System.Web.HttpApplication.PipelineStepManager.ValidateHelper(HttpContext context)</ErrStack>
    <Post>
    </Post>
    <Cookie>
    </Cookie>
</Item>

查了一下,原來網址後面多了空白 (%20) , 也就是 ? 前面多了空白
只是exception物件會自作聰明把他濾掉了,反而從 exception log 看不到資料
測試過,userd可以正常看網站,只是server會有不斷 excetion產生,有點煩
網路上雖有一些解法,但我想還是要求下廣告時,要注意網址問題


 
More...
darren, 2016/1/11 上午 09:51:49
HTTP Error 500.21 - PageHandlerFactory-Integrated



通常發生在新電腦安裝後​或是安裝 .NET 4.0 之後
第一次跑網站出現這樣的錯誤

執行下面cmd 就可以解決
%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe -i

 
More...
darren, 2015/4/2 下午 02:07:54
ThreadStart 未處理 Exception 造成網站Crash
最近把 shopunt 網站重啟的Log加上,發現網站有兩次時無預警的重啟
但是沒有exception log, 於是去看系統的 Event log, 發現出現以下的錯誤

應用程式: w3wp.exe
Framework 版本: v4.0.30319
描述: 處理序已終止,因為有未處理的例外狀況。
例外狀況資訊: System.Exception
堆疊:
於 UW.SQL.DTFromSQL(System.String, System.String)
於 UW.SQL.DTFromSQL(System.String, System.Data.SqlClient.SqlConnection ByRef, Boolean)
於 SHOPUNT.DB.Product.RebuildNotStopProducDT()
於 System.Threading.ExecutionContext.runTryCode(System.Object)
於 System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode, CleanupCode, System.Object)
於 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
於 System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
於 System.Threading.ThreadHelper.ThreadStart()

---------------------------------------------------------------------------------------------------------------------------------------

失敗的應用程式名稱: w3wp.exe,版本: 7.5.7601.17514,時間戳記: 0x4ce7afa2
失敗的模組名稱: KERNELBASE.dll,版本: 6.1.7601.18229,時間戳記: 0x51fb1677
例外狀況碼: 0xe0434352
錯誤位移: 0x000000000000940d
失敗的處理程序識別碼: 0x57c4
失敗的應用程式開始時間: 0x01d012faf33398f8
失敗的應用程式路徑: c:\windows\system32\inetsrv\w3wp.exe
失敗的模組路徑: C:\Windows\system32\KERNELBASE.dll
報告識別碼: 90ad2f4d-7f89-11e4-8ad2-e41f13b7d81e


原因是另開 Thread 以非同步取得非停售產品的資料時 產生 sql timeout,這時網站就整個 Crash 
約兩分鐘後才重新啟動,我想雙11網站一直Crash應該跟這個有關

改善方式:
1. RebuildNotStopProducDT 要 Try Catch 不要丟 exception 直接寄 mail 就好
2. 資料庫取得 "非停售產品" 有點沒有效率,不忙時至少要跑 4 秒,資料庫一忙就會Timeout,所以應該要把確定下架且不會販售的產品設定為停售 (Is_StopSell = 'Y'),這樣至少少了2000件產品的查詢,可以秒殺


另外 .NET 4.0 有新的物件叫做 Task 可以用來處理非同步程式,也可以處理 exception 狀況,有時間的話再來改看看
 
More...
darren, 2014/12/13 下午 05:44:05
.net 4.0 exception 潛在危險處理 - 自訂 RequestValidation
自從網站上了 net4.0 之後,網站會有為數不少的 "潛在危險" 的 exception
大都來自不友善的攻擊,想要測試網站的漏洞
網站做這層防護是好事,只是這個東西太敏感了,連簡單的冒號 & 符號都會跳 exception
更慘的是 Google Analytics 會在一些 user cookies 寫入xml文字 ( __utmz=... )
導致正常的 User 都不能正常瀏覽我們網站

解法有兩種:
1. 直接在 web.config 直接設定 不檢查
<system.web>
    <httpRuntime requestValidationMode="2.0" />
    <pages validateRequest="false" />
</system.web>

2. 自訂 RequestValidate (4.0以上才可以用)
請參考此文章 http://msdn.microsoft.com/en-us/library/system.web.util.requestvalidator(v=vs.100).aspx

後者比較算是正解 基本上處理掉 <script 我想 XSS 就解決一大半
 

More...
darren, 2014/7/22 上午 11:53:17
IE11 出現 JS Error : __doPostBack 未定義
這個問題與之前 reiko 提到的狀況是一樣的
http://blog.uwinfo.com.tw/auth/article/reiko/172
基本上就是 ASP.NET 無法辨別 IE11的UserAgent, 誤判他是別種瀏覽器造成

上此 hotfix 就可以解決 
http://support.microsoft.com/kb/2836939
More...
darren, 2014/5/23 下午 06:42:17
Server端的時區轉換
之前作的 MaskQueen專案 以及現在 UNT的TR獨立專案
都牽涉到後台使用者及前台User看訂單時間錯誤問題
因為系統時間是TW的時間而操作者是外國的使用者 這就需要有個方便模組來轉換系統時間以及user的時間顯示

這部分我以 Extension Method 方式來處理
in VB
Imports System.Runtime.CompilerServices
Imports Microsoft.VisualBasic
 
Public Module DateTimeExtension
 
    ''' <summary>
    ''' 將系統時間轉為當地的時間並轉為字串
    ''' </summary>
    ''' <param name="dtSystem"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    <Extension()> _
    Public Function ToCountryDateTimeString(ByVal dtSystem As DateTime) As String
 
        If dtSystem = DateTime.MinValue Then
            Return "n/a"
        End If
        Dim cstTime As DateTime = dtSystem.ToCountryDateTime()
        ' tr-TR -> dd.MM.yyyy HH:mm:ss
        Dim langCode As String = SHOPUNT.DB.SysConfig.GetSysConfig("DefaultLangCode")
        Dim culture As New System.Globalization.CultureInfo(langCode)
        If cstTime.AddMonths(6) < Now Then
            Return cstTime.ToString("dd.MM.yyyy HH:mm", culture)
        Else
            Return cstTime.ToString("dd.MMM HH:mm", culture)
        End If
 
    End Function
 
    ''' <summary>
    ''' 將系統時間轉為當地的時間
    ''' </summary>
    ''' <param name="dtSystem"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    <Extension()> _
    Public Function ToCountryDateTime(ByVal dtSystem As DateTime) As DateTime
        Dim cstZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(SHOPUNT.DB.SysConfig.GetSysConfig("DefaultTimeZone"))
        Dim localZone As TimeZoneInfo = TimeZoneInfo.Local
        Dim cstTime As DateTime = TimeZoneInfo.ConvertTime(dtSystem, localZone, cstZone)
        Return cstTime
    End Function
 
    ''' <summary>
    ''' 將使用者輸入的時間轉為系統時間
    ''' </summary>
    ''' <param name="dtCountry"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    <Extension()> _
    Public Function ToSystemDateTime(ByVal dtCountry As DateTime) As DateTime
        Dim cstZone As TimeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(SHOPUNT.DB.SysConfig.GetSysConfig("DefaultTimeZone"))
        Dim localZone As TimeZoneInfo = TimeZoneInfo.Local
        Dim sysTime As DateTime = TimeZoneInfo.ConvertTime(dtCountry, cstZone, localZone)
        Return sysTime
    End Function
 
End Module
使用上 只要
DateTime.Now.ToCountryDateTime() 就可以把系統時間轉換成user時間
相反的也有把 user時間轉換成系統時間的功能 ToSystemDateTime()

英國的TimeZone: GMT Stanard Time
Turkey的TimeZone: Turkey Stanard Time
以上的值可以用 TimeZoneInfo.GetSystemTimeZones() 找出來
More...
darren, 2014/5/2 下午 12:27:18
List.Find - 找出 List 裡符合條件的資料
從 List<T> 找出符合條件的資料


        List<DB.Member> listOfMember = new List<DB.Member>()
                { new DB.Member(15), new DB.Member(20), new DB.Member(25), new DB.Member(30) };

        // Exists: 單純看有無符合條件的資料
        bool IsMemberExists = listOfMember.Exists(x => x.Email == "darren@acaciaco.com");
        // FindIndex: 找出第一個符合條件的 index,找不到傳回 -1
        int index = listOfMember.FindIndex(x => x.Email == "darren@acaciaco.com");
        // Find: return 第一個符合條件的object, 找不到傳回 null
        DB.Member objMember = listOfMember.Find(x => x.Email.Contains("acaciaco.com"));
        // FindAll: return 所有符合條件的objects
        List<DB.Member> listOfMember2 = listOfMember.FindAll(x => x.Email.Contains("acaciaco.com"));


VB

Dim listOfMember As New List(Of DB.Member)() From { _
    New DB.Member(15), New DB.Member(20), New DB.Member(25), New DB.Member(30) }

' Exists: 單純看有無符合條件的資料
Dim IsMemberExists As Boolean = listOfMember.Exists(Function(x) x.Email = "darren@acaciaco.com")
' FindIndex: 找出第一個符合條件的 index,找不到傳回 -1
Dim index As Integer = listOfMember.FindIndex(Function(x) x.Email = "darren@acaciaco.com")
' Find: return 第一個符合條件的object, 找不到傳回 Nothing
Dim objMember As DB.Member = listOfMember.Find(Function(x) x.Email.Contains("acaciaco.com"))
' FindAll: return 所有符合條件的objects
Dim listOfMember2 As List(Of DB.Member) = listOfMember.FindAll(Function(x) x.Email.Contains("acaciaco.com"))
More...
darren, 2014/3/26 上午 09:43:39
MailMessage, SmtpClient 要 Dispose

今天發現當 System.Net.Mail.MailMessage  有附件時,SendMail 後附檔會被Lock住
原來使用完之後要釋放資源,不然要等一段時間才會被系統釋放

另外 .Net 4.0 的 SmtpClient 物件也要 Dispose()
他的做法也類似 SqlCoonection 有 pooling 的機制
因此用完也必須要 Dispose()

UW.Mail 我有調整過了 要SVN更新一下 再build

More...
darren, 2013/1/27 上午 03:11:35
|< 12 >|
頁數 1 / 2 下一頁
~ Uwinfo ~