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
標籤
  • 7307
  • UWInfo Blo
  • orm
  • C
  • Deadlock
  • regex
  • 黑貓 EGS
  • 70
  • List
  • for
  • inertSQL
  • CK
  • big5
  • LazyLoad
  • 超出
  • 光
  • net ORDER
  • if
  • 5151
  • ti
  • let
  • NrhnyO3Z
  • date[t],
  • UNT
  • net
  • 0
  • Image
  • �
  • Referrer
  • [U2]
  • 220
  • 無法對應路徑
  • join
  • 735
  • 日期
  • GDI
  • [t]
  • 50
  • AD
  • db
  • a generic
  • visual
  • Lucene.Net
  • debug
  • WU
  • 必學
  • autopostba
  • 存取被拒
  • clipboard
  • find
頁數 3 / 3 上一頁
搜尋 response 結果:
善用 Request.Cookies.Set After Respnse.Cookies.Add
ASP.NET程式開發時,有時候會寫資料到cookies
這時我們會用 Response.Cookies.Add 寫入
但是大家都會忽略到一種情況,如果後面程式也會使用到該cookies時
Request.Cookies 會抓不到剛設定的cookies
這時就要 Request.Cookies.Set 來設定 Request 值

錯誤示範:
Page_Load --> Response.Cookies.Add a Cookie named "test"
Page_PreRender --> Request.Cookies("test") --> Nothing 

正確示範(同時寫兩行):
Page_Load --> Response.Cookies.Add a Cookie named "test"
              Request.Cookies.Set a Cookie named "test" 
Page_PreRender --> Request.Cookies("test") --> Got it!

 
More...
darren, 2013/11/4 下午 06:37:03
web.config 幫特定網頁或是目錄設定config
由於遇到信用卡 return 的 Form 中文是用 big5 encode 狀況
而我們網站都是UTF-8, 因此 Request.Form 的中文內容會變成亂碼
因此必須設定網頁的 RequestEncoding 為 big5 
可惜 .NET 2.0 的 @Page 屬性無法設定 RequestEncoding, 只能由 web.config 下手
幸好 web.config 可以設定 locaion 為特定網頁或目錄設定屬性
設定如下(append 在根目錄 configuration 下即可):

  <location path="tch/Shopping/NCCReturn.aspx">
    <system.web>
      <globalization fileEncoding="utf-8" requestEncoding="big5" responseEncoding="utf-8" culture="zh-TW"/>
    </system.web>
  </location>
More...
darren, 2013/8/7 下午 03:21:04
Cross site ajax
今天去亞卡讀書會剛好有提到跨站的 ajax
除了JSONP之外,其實W3C也有訂標準
http://www.w3.org/TR/cors/
https://developer.mozilla.org/zh-TW/docs/HTTP/Access_control_CORS
基本精神就是
A網站呼叫B網站
A網站的Request Header要加上 Origin: (這個瀏覽器會自動加上)
B網站Response Header要加上一些 Access-Control-Allow-Origin:
這樣就可以通了 不過Request並不會帶上B網站的cookies
若是希望 Request 時也要送上 cookies 資訊,則http物件要加上 .withCredentials = true
不過 IE7以下確定是不支援這的機制,IE8以上則還要測看看

 
More...
darren, 2013/5/14 下午 11:40:25
Response.Redirect throws an “Thread was being aborted”
當我們用 try catch 去包程式時,要注意不要讓程序結束跳出
這樣會引發 Thread was being aborted 錯誤
例如 try catch 不要做 Respnse.Redirect 動作
請參考此文章
 
More...
darren, 2013/3/15 上午 11:21:31
IE Cookie 奇怪的問題
A Domain 底下有一個 B Domain 的 iFrame,B Domain 在client 有對自己的domain 設些cookie,
但 IE cookie 寫不進去,

原因如下面網址: http://www.cr173.com/html/16696_1.html
加入這行 IE 就好囉!   Response.AddHeader("P3P", "CP=CAO PSA OUR")
More...
瞇瞇, 2013/1/30 下午 07:58:45
Jquery Ajax error 之 parsererror 訊息
最近弄ajax 發現一個現象 先記起來一下
當 ajax dataType 是 json 時
            $.ajax({
                cache: false,
                data: "fun=SetAsBestAnswer&aid=" + articleId + "&rid=" + replyId,
                dataType: "json",
                success: function (objData, strTextStatus) {
                ...........

response的文字它會自動轉為物件,是以 jQuery.parseJSON 處理轉為此範例的 objData
但是有時會發生 parsererror 的錯誤
後來我發現是因為json 的 key 值必須要雙引號包起來才可以
然後字串內容也不能有斜線+單引號 \'   所以以下三者都是會失敗的
{test: "I'm a student."} 
{'test': "I'm a student."}
{"test": "I\'m a student."}

以下兩個都是OK的
{"test": "I'm a student."} --> OK
{"test": "I\u0027m a student."} --> OK


More...
darren, 2012/8/17 上午 11:39:28
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
C# memo
*****2012/08/03************************************************
vb: a mod b
c#: a % b

*****2012/06/27************************************************
Server.UrlEncode("xxxx") => HttpUtility.UrlEncode("xxxxx");
Response.Write("XXX") =>  HttpContext.Current.Response.Write("XXX");
******************************************************************

型別轉換(int)XXXXXX,將XXXXX轉換為型別int

轉換Value 至 Enum
oRec.Status = (DB.ForumArticle.EN.Status)Enum.Parse(typeof(DB.ForumArticle.EN.Status), this.ddlENStatus.SelectedValue);

強制轉換型別至int
int Status = (int)DB.ForumArticle.EN.Status.Deleted;

vb
Public Shared Funciont AA() as string
 return xxxxx
End Function


C#
public static string aa()
{
 return xxxx
}



vb
Public Shared Sub AA()
......
End Sub


C#
public static void AA()
{
.....
}



vb
Try
 xxxxxx
Catch ex As Exception
 UW.WU.WriteErrorToLog(ex)
End Try


C#
try
{
 xxxxxx
}
catch (Exception ex)
{
 tran.Rollback();
}



Split
char[] delimiterChars = { ',' };
foreach (string tags in cbTags.Split(delimiterChars))
{

}



vb
select case AA
 case "AA"
  xxx
 case "BB"
  bbb
 case else
  aaaa
end select


C#
switch (AA) {
 case "AA":
  xxx();
  break;
 case "BB":
  bbb();
  break;
 default:
  aaaa();
  break;
}
More...
Reiko, 2012/5/31 上午 11:55:50
|< 123 >|
頁數 3 / 3 上一頁
~ Uwinfo ~