Time of Update: 2018-12-07
這些天做一個項目時需要儲存使用者名稱和密碼,以前在上學的時候也沒有做過類似的,只是上課的時候做過兩個Example,以後就再也沒有做過。在實際應用中用到Cookie可以說這是第一次。出事不利啊,先有幾個問題列出,當然其中有自己的理解,不對之處請大家指出。1、HttpCookie的Expires屬性設定過以後在設定成功以後再次獲得Cookie時調試的時候是看不到真實的值的,但是他確實是存在的。2、Response.Cookies取到的Cookies值是沒有子健的,無論事先是否設定了子健,當用Res
Time of Update: 2018-12-07
最近本人正開發關於asp.net MVC的項目,裡面的各種各種泛型、lamp運算式把我搞的暈頭轉向,在這裡做點總結,方便以後的查看。IDictionary<string, object> attributes :new Dictionary<string, object> { { "class", "tableHead" }}new RouteValueDictionary(new { id=item.ID }))
Time of Update: 2018-12-07
1、DateTime 數字型System.DateTime currentTime=new System.DateTime(); 1.1 取當前年月日時分秒 currentTime=System.DateTime.Now; 1.2 取當前年 int 年=currentTime.Year; 1.3 取當前月 int 月=currentTime.Month; 1.4 取當前日 int 日=currentTime.Day; 1.5 取當前時 int 時=currentTime.Hour; 1.6
Time of Update: 2018-12-07
文章目錄 大家都知道通過以下的方法實現對所有頁面的身份認證要求:<authentication mode="Forms"> <forms name=".OnLineWork" loginUrl="logoin.aspx" protection="All" timeout="60" /> </authentication> <authorization> <deny
Time of Update: 2018-12-07
private void btnSubmit_Click(object sender, System.EventArgs e){ //SmtpMail.Send("shaozhd@263.net","shaozhd@263.net","Test","Hello"); MailMessage m = new MailMessage(); m.From = tbFrom.Text; m.To = tbTo.Text; m.Subject = tbSubject.Text; m.Body =
Time of Update: 2018-12-07
TIP:Transaction使用原則,只在程式需要的時候使用.例如:如果是簡單的從資料庫取資料,或者簡單的查詢,你就不需要使用transaction,另一方面,如果你是在幾個相關聯的表中插入資料,你就需要使用事務.一般來講,我們不會為一個簡單的操作使用事務:比如Update,DELETE或者Insert.Even though ADO.NET provides good support for transactions, you should not always use
Time of Update: 2018-12-07
REF:http://forums.aspfree.com/net-development-11/displaying-multiple-columns-in-a-html-listbos-control-in-asp-19062.html listbox column spacing solution FINALLY!!! I Know so many people have had this problem. But finally i solved it with your basic
Time of Update: 2018-12-07
在學齡前學習c#的過程中,經常遇到這樣的語句: public string StudentName { get{return stuName;} set{stuName=value;} } 當時也不是很明白為什麼要這樣?學深了c#後,又沒法對其做一個總結。今天看了《Visual
Time of Update: 2018-12-07
覺得非常有用,保留一份。原文http://www.cnblogs.com/me-sa/archive/2007/07/04/80...Application1. Application用來儲存所有使用者共用的資訊 2. 在Asp時代,如果要儲存的資料在應用程式生存期內不會或者很少發生改變,那麼使用Application是理想的選擇。但是在Asp.net開發環境中我們把類似的配置資料放在Web.config中。 3. 如果要使用Application
Time of Update: 2018-12-07
一個簡單例子如下: 1、建立預存程序(用於使用者身分識別驗證): Create Procedure CheckUser ( @userid char(20), @userpsw char(20) ) as if exists(select * from tb_UserInfo where rtrim(UserID)=@userid and rtrim(UserPsw)=@userpsw) return
Time of Update: 2018-12-07
代碼Code highlighting produced by Actipro CodeHighlighter
Time of Update: 2018-12-07
Html.DropDownList 使用 (一)原型一:public static string DropDownList(this HtmlHelper htmlHelper, string name){ IEnumerable<SelectListItem> selectData = htmlHelper.GetSelectData(name); return htmlHelper.SelectInternal(null, name, selectData,
Time of Update: 2018-12-07
一直沒去研究,終於受不了,找個解答: 模版頁中難免要引用CSS、指令碼、圖片等,這些檔案的路徑如果簡單的使用相對路徑,那麼如果引用模版的目錄一發生變化,這些路徑就會出錯;如果使用絕對路徑,又不夠靈活,如果應用程式目錄發生變化,可能會導致要大量修改。asp.net支援一種相對於應用程式的路徑,以波浪線開頭的,形如"~/",使用它即可解決,例如:<link rel="stylesheet" media="screen" type="text/css"
Time of Update: 2018-12-07
<%From_url = Cstr(Request.ServerVariables("HTTP_REFERER"))Serv_url = Cstr(Request.ServerVariables("SERVER_NAME"))if mid(From_url,8,len(Serv_url)) <> Serv_url then response.write "非法連結!" '防止盜鏈 response.endend ifif Request.Cookies("Logined")="
Time of Update: 2018-12-07
<%@ Page Language="C#" %><%@ Import Namespace="System.IO" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><script runat="server"> void Treeview1_TreeNodePopulate(object sen
Time of Update: 2018-12-07
一、全頁面靜態緩衝: 在頁面<%@Page ...%>下加一行: <%@OutputCache Duration="60" VaryByParam="none"%> //緩衝時間60秒,不根據參數緩衝不同頁面 二、根據參數緩衝不同頁面: <%@OutputCache Duration="60" VaryByParam="state"%>
Time of Update: 2018-12-07
private void btnUpload_Click(object sender, System.EventArgs e){ //得到使用者要上傳的檔案名稱 string strFilePathName = loFile.PostedFile.FileName; string strFileName = Path.GetFileName(strFilePathName); int FileLength =
Time of Update: 2018-12-07
UserControl1.ascx和UserControl2.ascx為先後在Test.aspx中建立的使用者控制項:執行步驟Test.aspxUserControl1.ascxUserControl2.ascx1 OnInit 2 Init 3 OnInit4 Init5OnInit 6Init 7Load 8 Load 9 Load10(Buttom_Click...)(Buttom_Click...)(Buttom_Click...)11PreRender 12 PreRen
Time of Update: 2018-12-07
文章目錄 步驟1步驟2步驟3步驟4運行結果如所示步驟1步驟2步驟3步驟4步驟5 案例1本文參考WF (Windows Workflow Foundation) 工作流程學習(一)一個Asp.Net狀態機器驗證程式 通過本文本文的介紹,我們主要瞭解wf中的狀態機器statemachine在asp.net下的運行機制。開發環境:win7+vs2008
Time of Update: 2018-12-07
其實如果是在windows 的表單中,水晶報表的Crystalreportviewer本身提供了匯出功能,所以可以不需要編寫任何代碼。