About Log4Net在WEB中应用

Posted by & filed under ASP.NET.

如何使用log4net在Web中应用?其实很简单,你只要对程序作如何修改即可:
1.在common中加入log4netHelper.cs

public class log4netHelper

{

public static void debug(string message)

{

log4net.ILog log = log4net.LogManager.GetLogger(“Test”);

if (log.IsDebugEnabled)

{

log.Debug(message);

}

log = null;

}

public static void error(string message)

{

log4net.ILog log = log4net.LogManager.GetLogger(“Test”);

if (log.IsErrorEnabled)

{

log.Error(message);

}…

ASP.NET程序中常用的三十三种代码

Posted by & filed under ASP.NET.

1. 打开新的窗口并传送参数:

传送参数:

response.write(“<script>window.open(‘*.aspx?id=“+this.DropDownList1.SelectIndex+”&id1=“+...+”‘)</script>“)

接收参数:

string a =
Request.QueryString(“id”);

string b =
Request.QueryString(“id1”);

2.为按钮添加对话框

Button1.Attributes.Add(“onclick”,”return
confirm(‘
确认?’)”);

button.attributes.add(“onclick”,

”if(confirm(‘are you sure...?’)){return
true;}else{return false;}”)

3.删除表格选定记录

int intEmpID
= (int)MyDataGrid.DataKeys[e.Item.ItemIndex];

string
deleteCmd = “DELETE from Employee where emp_id =

【ASP.NET】ダウンロード後の画面リフレッシュの方法

Posted by & filed under ASP.NET.

http://www.atmarkit.co.jp/bbs/phpBB/viewtopic.php?topic=30252&forum=7
ASP.NET(VB.NET)で開発しております。

現在、ある画面で日付を入力させ、画面上に配置してある実行ボタンを押したタイミングで日付を元にサーバ側で対象データを抽出・ファイルを作成し、そのファイルをクライアント側にダウンロードさせています。

実行ボタンを押した際に、サーバ側で日付チェックを行なっており、指定できない日付の場合に、画面上のメッセージ出力用ラベルにエラーメッセージを出力しています。

画面にエラーメッセージが表示されている状態で、正しい日付を入力して実行ボタンを押すと、エラーメッセージが表示された状態で処理が正常に進ん でいくので違和感があります。よって、何かのタイミングでエラーメッセージを消したいと思うのですが、うまくいかなくて悩んでいます。何か回避手段はある のでしょうか?
メッセージを消すタイミングは、ダウンロード前でも後でも構わないのですが。

ちなみに、実行ボタンが押されたイベントで以下のような感じでダウンロードさせているため、サーバに制御が戻ってこないのではないか、と考えています。

コード:
Response.Clear()
Response.ContentType = "application/x-zip"
Response.Charset = ""
Response.AddHeader("content-disposition", "attachment; filename=" + HttpUtility.UrlEncode("報告書_") + ls_TaisyoYmd + "_Test.lzh")
Response.WriteFile(Server.MapPath("lzh/" & ls_LzhFile & ".lzh"))
Response.End()


12个.net 开发者值得去读的国外Blog

Posted by & filed under ASP.NET.

12个.net 开发者值得去读的国外Blog – EricLee:

为什么会是12个?来自weblogs.asp.net 的Jon Galloway 为广大.net开发爱好者推荐了10个值得阅读的技术Blog。一位来自Scobleizer Blog 的热心读者在留言中也推荐了2个,加在一起12个。

  1. Christopher Steen – Link blogger extrordinaire.
  2. Coding Horror (Jeff Atwood) – Excellent writer with a lot to say about how software development ought to be done, fun stuff about