2009/02/09

.Net 新手之global.asax - application 的用法 (2)

Application 的執行流程,我參考這一個網站的 sample 做一些改寫,並且標上順序...以方便我未來寫程式時的參考資料。

<%@ Application Language="C#" %>

<script runat="server">

void Application_Start(Object sender, EventArgs e) {
Application.Set("Time", System.DateTime.Now);
}

// 1.
void Application_BeginRequest(Object sender, EventArgs e)
{
Response.Write("<b>Process</b>");
Response.Write("Request is starting...<br>");
}

// 2.
void Application_AuthorizeRequest(Object sender, EventArgs e)
{
Response.Write("Authorizing request...<br>");
}

// 3.
void Application_ResolveRequestCache(Object sender, EventArgs e)
{
Response.Write("Resolving request cache...<br>");
}

// 4.
void Session_Start(Object sender, EventArgs e)
{
Response.Write("Session is starting...<br>");
}

// 5.
void Application_AcquireRequestState(Object sender, EventArgs e)
{
Response.Write("Acquiring request session state" + "...<br>");
}

// 6.
void Application_PreRequestHandlerExecute(Object sender, EventArgs e)
{
Response.Write("Pre Request handler executed...<br>");
}

// 7. 已處理完後的流程
void Application_PostRequestHandlerExecute(Object sender, EventArgs e)
{
Response.Write("Post Request handler executed...<br>");
}


// 8.
void Application_ReleaseRequestState(Object sender, EventArgs e)
{
Response.Write("Releasing request state...<br>");
}

// 9.
void Application_UpdateRequestCache(Object sender, EventArgs e)
{
Response.Write("Updating request cache...<br>");
}

void Application_AuthenticateRequest(Object sender, EventArgs e)
{
Application.Set("Time", System.DateTime.Now);
}

// 10.
void Application_EndRequest(Object sender, EventArgs e)
{
Response.Write("Request is ending...<br>");
}

// 11.
void Application_PreSendRequestHeaders(Object sender, EventArgs e)
{
Response.Write("Receiving request headers...<br>");
}

// 12.
void Application_PreSendRequestContent(Object sender, EventArgs e)
{
Response.Write("Receiving request content...<br>");
}

// Exception
void Application_Error(Object sender, EventArgs e)
{
Response.Write( " is authenticating request...<br>");
}

</script>

2009/02/08

實用英語句型

Would/Do you know of
當我們到我們不熟悉的地方時,想請問別人有什麼地方好去或好吃時,我們可以用…
Would/Do you know of a place ...
  • Would you know of a place we can get a lunch?
  • Do you know of a place nearby to eat?
  • Would you know of a place we can get
Would/Do you know of ... 我覺得是一個很實用的句型,例如說:
  • Would you know of any airline ...
  • Would you know of any decent deli ...
  • Would you know of any website we can ...
In that case
In that case 的用法:In that case 中文翻譯是「那樣的話」,在書本上看到這一個 phrase 的時候,應該可以把這一個 phrase 用在很多地方,譬如說當對方在表達對方的想法或意見的時候我們可以回答:
  • In that case, why don't we eat at night market.
  • In that case, I'll book other meeting for topic.
I'm afraid
I'm afraid (that) + 子句 ... 這一種句型我們常常見到,有表「恐怕」的意思,例如說:
  • I'm afraid I am busy at the afternoon.
  • I'm afraid their decision is final.
除了接子句之外,也常常接介系詞 of,表對某事感到恐懼:
  • I'm afraid of ghost.
  • I'm afraid of my mother.
也可以簡單的來表示「恐怕不行」、「恐怕是這樣」
  • I'm afraid not. 恐怕不行。
  • I'm afraid so. 恐怕是這樣。