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

搜尋意見
文章分類-#Author#
[所有文章分類]
所有文章分類
  • 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)
最新回應
  • Newtonsoft.Json.JsonConvert.DeserializeObject 失敗的情況
    test...more
  • dotnet ef dbcontext scaffold
    ...more
  • [ASP.NET] 利用 aspnet_regiis 加密 web.config
    ...more
  • IIS ARR (reverse proxy) 服務安裝
    ...more
  • [錯誤訊息] 請加入 ScriptResourceMapping 命名的 jquery (區分大小寫)
    ...more
  • 用 Javascript 跨網頁讀取 cookie (Cookie cross page, path of cookie)
    ...more
  • 線上客服 - MSN
    本人信箱被盜用以致資料外洩,是否可以請貴平台予以協助刪除該信箱之使用謝謝囉...more
  • 插入文字到游標或選取處
    aaaaa...more
  • IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
    太感謝你了~~~你救了我被windows 認證卡了好幾天QQ...more
  • PostgreSQL 的 monitor trigger
    FOR EACH ROW 可能要改為 FOR EACH STATEMENT ...more
標籤
  • 36
  • gmail
  • virtual
  • ef
  • 28
  • popup
  • image
  • 224
  • 526
  • ses
  • 772
  • offset
  • xml
  • 364
  • response
  • db
  • 444
  • resize
  • 484
  • 2246
  • 438
  • firewall
  • 728
  • 8308
  • 516
  • 66
  • 628
  • 72
  • 896
  • 864
  • 436
  • 3991
  • find
  • 80
  • 內碼
  • git
  • 590
  • vpn
  • message
  • max
  • 476
  • 654
  • 6866
  • C
  • 828
  • aes
  • mine
  • backup
  • -1797
  • 3128
頁數 4 / 4 上一頁
搜尋 SES 結果:
攝影家手札機房設定
這是一篇加密文章,需輸入密碼才可閱讀
More...
Jerry, 2013/4/13 下午 04:01:54
查詢 Lock (Deadlock) 源頭用的 SQL
declare @spid int,@bl int
DECLARE s_cur CURSOR FOR
select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a
where not exists(select * from (select * from sysprocesses where blocked>0 ) b
where a.blocked=spid)
union select spid,blocked from sysprocesses where blocked>0
OPEN s_cur
FETCH NEXT FROM s_cur INTO @spid,@bl
WHILE @@FETCH_STATUS = 0
begin
if @spid =0
select N'引起數據庫死鎖的是:
'+ CAST(@bl AS VARCHAR(10)) + N'進程號,其執行的SQL語法如下'
else
select N'進程號SPID:'+ CAST(@spid AS VARCHAR(10))+ N'被進程號SPID:'+ CAST(@bl AS VARCHAR(10)) +N'阻塞,其當前進程執行的SQL語法如下'
DBCC INPUTBUFFER (@bl )
FETCH NEXT FROM s_cur INTO @spid,@bl
end
CLOSE s_cur
DEALLOCATE s_cur


刪除 procedure
Kill XXX
More...
Bike, 2012/12/26 下午 05:03:52
各瀏覽器切分Session的方法
請參考 http://www.dotblogs.com.tw/jimmyyu/archive/2009/11/21/12097.aspx
More...
Bike, 2012/9/19 上午 04:46:04
global.asax 的事件
從 http://blog.ie-soft.de/post/2007/12/globalasax-events.aspx  抄來的. 留作參考

HttpApplication Events:

Application_AcquireRequestState
Occurs when ASP.NET acquires the current state (for example, session state) that is associated with the current request. 

Application_AuthenticateRequest
Occurs when a security module has established the identity of the user. 

Application_AuthorizeRequest
Occurs when a security module has verified user authorization. 

Application_BeginRequest
Occurs as the first event in the HTTP pipeline chain of execution when ASP.NET responds to a request. 

Application_Disposed
Adds an event handler to listen to the Disposed event on the application. 

Application_EndRequest
Occurs as the last event in the HTTP pipeline chain of execution when ASP.NET responds to a request. 

Application_Error
Occurs when an unhandled exception is thrown. 

Application_PostAcquireRequestState
Occurs when the request state (for example, session state) that is associated with the current request has been obtained. 

Application_PostAuthenticateRequest
Occurs when a security module has established the identity of the user. 

Application_PostAuthorizeRequest
Occurs when the user for the current request has been authorized. 

Application_PostMapRequestHandler
Occurs when ASP.NET has mapped the current request to the appropriate event handler. 

Application_PostReleaseRequestState
Occurs when ASP.NET has completed executing all request event handlers and the request state data has been stored. 

Application_PostRequestHandlerExecute
Occurs when the ASP.NET event handler (for example, a page or an XML Web service) finishes execution. 

Application_PostResolveRequestCache
Occurs when ASP.NET bypasses execution of the current event handler and allows a caching module to serve a request from the cache. 

Application_PostUpdateRequestCache
Occurs when ASP.NET completes updating caching modules and storing responses that are used to serve subsequent requests from the cache. 

Application_PreRequestHandlerExecute
Occurs just before ASP.NET begins executing an event handler (for example, a page or an XML Web service). 

Application_PreSendRequestContent
Occurs just before ASP.NET sends content to the client. 

Application_PreSendRequestHeaders
Occurs just before ASP.NET sends HTTP headers to the client. 

Application_ReleaseRequestState
Occurs after ASP.NET finishes executing all request event handlers. This event causes state modules to save the current state data. 

Application_ResolveRequestCache
Occurs when ASP.NET completes an authorization event to let the caching modules serve requests from the cache, bypassing execution of the event handler (for example, a page or an XML Web service). 

Application_UpdateRequestCache
Occurs when ASP.NET finishes executing an event handler in order to let caching modules store responses that will be used to serve subsequent requests from the cache. 

Application_Init
This method occurs after _start and is used for initializing code. 

Application_Start
As with traditional ASP, used to set up an application environment and only called when the application first starts.

Application_End
Again, like classic ASP, used to clean up variables and memory when an application ends.

Session Events:

Session_Start
As with classic ASP, this event is triggered when any new user accesses the web site.

Session_End
As with classic ASP, this event is triggered when a user's session times out or ends. Note this can be 20 mins (the default session timeout value) after the user actually leaves the site.

Profile Events:

Profile_MigrateAnonymous
Occurs when the anonymous user for a profile logs in.

Passport Events:

PassportAuthentication_OnAuthenticate
Raised during authentication. This is a Global.asax event that must be named PassportAuthentication_OnAuthenticate.
 

Possibly more events defined in other HttpModules like:

System.Web.Caching.OutputCacheModule
System.Web.SessionState.SessionStateModule
System.Web.Security.WindowsAuthentication
System.Web.Security.FormsAuthenticationModule
System.Web.Security.PassportAuthenticationModule
System.Web.Security.UrlAuthorizationModule
System.Web.Security.FileAuthorizationModule
System.Web.Profile.ProfileModule

More...
Bike, 2012/6/9 上午 08:55:08
VB 轉 C# 問題整理
之前將部分UW網站VB程式碼轉到C#,
我是用此工具轉
http://www.developerfusion.com/tools/convert/vb-to-csharp/
轉換後,放到visual studio還是有很多毛毛蟲
整理一些問題, 希望能減少轉換上的困難
 
1. Imports --> using (using 只能用namespace)
   System.Web.HttpContext 是不能放在using, 因為他是類別, 不是 namspace
   所以 Current.Session 要調整成 HttpContext.Current.Session
 
2. index或是key, value類的東西要用中括號 []
   VB:Session("name") --> C#:Session["name"]
   Cache(""), Application(""), DataRow("") 也是一樣
   
3. 所有方法都要加上 ()
   例如 ToString --> ToString()
   例如 ToLower --> ToLower()
 
4. 不能隱含式的型別轉換, 要明確
   轉換型態可以有以下方法
   - 轉字串時, 直接後面加上 .ToString()
   - Convert 物件轉換
   - 變數名稱前面加上(Type), 例如 (HashTable)Session["htData"]
   - 以 as 方式轉換, 若要轉換的物件可能是null建議用此方法, 例如 
     System.Net.HttpWebRequest http = System.Net.WebRequest.Create(Url) as System.Net.HttpWebRequest;
     string strData = HttpContext.Current.Cache["CacheName"] as string;
     用 as 方法不會強制轉換, 用 (Type) 或 ToString() 一旦遇到 null 會發生Exception
 
5. 帶參數的 Property C#是不允許的, .Net 會自動產生 get_ function 取代
   VB: UW.WU.URL --> C#: UW.WU.get_URL();
 
6. partial 要放在 public 後面
 
7. aspx頁面C#的檔頭要設定AutoEventWireup="true"
     另外所有的 server control 的 On Event 所執行的function name (例如 Button 的 OnClick)  都要在 aspx 裡面設定
   (這部分會在後台程式發生,因為轉換後常忘了加)
   <asp:DropDownList ID="ddlName" runat="server" AutoPostBack="true" 
      OnSelectedIndexChanged="ddlName_SelectedIndexChanged"></asp:DropDownList>
   <asp:Button ID="btnAdd" runat="server" Text="新增" OnClick="btnAdd_Click" />
 
8. 因為字串相加也是 +, 一些特殊寫法要注意
   VB: (Url & "Page=" & EndPage + 1)    --> VB會先將整數加好後再字串相加
   c#: (Url + "Page=" + (EndPage + 1))  --> 由於C#會先將1轉為字串再把所有字串相加 , 所以要先用括號包起來先讓整數相加

9. vbCrLf -> "\r\n"
    vbTab ->  "\t"

10. VB function 轉換 
    Conversion.Fix -> Math.Floor
     Strings.Format(x, "###0.0") -> 用 x.ToString("N1");

11. EN 處理要多加注意,需額外加 (int) 才會顯示數值,很多 sql 指令這樣拼要小心
" where EN_產品性質 = " + SHOPUNT.EN.產品性質.非成品 ; -> where EN_產品性質 = 非成品   (會出錯)
" where EN_產品性質 = " + (int)SHOPUNT.EN.產品性質.非成品; -> where EN_產品性質 = 100

先整理這些 以後遇到再加上


 
More...
darren, 2012/5/17 上午 10:50:34
iframe裡的網頁網頁無法寫入cookie
當A網站的網頁裡面開一個iframe連結到B網站的網頁
結果B網站的Cookies卻一直無法寫入,最常顯示的狀況是session無效
如果發生這樣的狀況 請記得在 IIS 設定 http header, "P3P"
詳細參考 http://adamyoung.net/IE-Blocking-iFrame-Cookies
也可以參考 w3c P3P 
More...
darren, 2012/5/14 下午 05:32:09
Select with XLock
在 Select 指令後, 依據結果做一些工作, 即使有 Transaction, 但還是有可能發生一致性的問題:

Ex:

        Dim Conn As SqlConnection = UW.SQL.GetOpenedConnection
        Dim Tran As SqlTransaction = Conn.BeginTransaction

        Try
            Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA Where Id = 1", Tran)
            C = C + 1
            UW.SQL.executeSQL("Update TableA Set Counter = " & C & " Where  Id = 1", Tran)
            Tran.Commit()
        Catch ex As Exception
            Tran.Rollback()
            UW.WU.DebugWriteLine(ex.ToString, True, True)

        Finally
            If Conn.State <> ConnectionState.Closed Then
                Conn.Close()
            End If

        End Try


以上的程式由兩個 Session 同時執行時, 並不能保証 Counter 會被加 2

若是要保証兩個 Session 都會把 Counter 加一(總共加 2), 要把以下這一行

Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA Where Id = 1", Tran)

改為

Dim C As Int32 = UW.SQL.GetSingleValue("Select Counter From TableA With(XLock) Where Id = 1", Tran)
More...
Bike, 2012/5/3 下午 03:02:16
|< 1234 >|
頁數 4 / 4 上一頁
~ Uwinfo ~