跳到主要內容

發表文章

[MVC] CKEditor

//官網下載:http://ckeditor.com/download Nuget 套件管理工具下載:搜尋  HtmlSanitizationLibrary //.cshtml [View]  @using (Html.BeginForm("functionname", "MyBlog", FormMethod.Post, new { id = "FormNew" }))     {  @Html.TextAreaFor(model => model.content, new { id = "content", @name = "content" })  <script type="text/javascript">             CKEDITOR.replace('content', { width: '800px' });  </script> } //MyBlogController.cs [Controller] [HttpPost]     [ValidateInput(false)]      //解決html1編碼問題 public ActionResult functionname(string Title, string content)   //Title,content自動對應到html的id { int RtnCode = m.MyDataEdit(AID, Sanitizer.GetSafeHtmlFragment(Title),Sanitizer.GetSafeHtmlFragment( content)); } 於VS2010就可以透過NuGet幫網站專案安裝上 AntiXSS 程式中使用AntiXSS的 Sanitizer.GetSageHtmlFragement() 方法,取得安全的HTML區段內容。 參考連結: ASP.NET MVC 3 使用 CKEditor 【.NET】防止XSS攻擊 [ config 全部可編輯的T...

[HTML] PostBack 後 ScrollarBar 維持原位置

[HTML]  //支援所有瀏覽器 < script   type   =   "text/javascript">  window.onload =  function  () {          var  scrollY = parseInt( ' <% =Request.Form["scrollY"]  %> ' );                       if  (!isNaN(scrollY)) {             window.scrollTo(0, scrollY);         }     };     window.onscroll =  function  () {          var  scrollY = document.body.scrollTop;          if  (scrollY == 0) {              if  (window.pageYOffset) {          ...

[檔案] 版本控管

以MS VS為例,版控的軟體有TFS、SVN 現在就以開放式軟件的SVN來做介紹 SVN安裝程序 * VisualSVN 安裝在Server,控管所有同步的檔案(Repository)     就是一個Repository(檔案庫),可以設定User權限 *TortoiseSVN 安裝在放程式目錄的位置   可以只安裝TortoiseSVN , Repository(檔案庫)可自己開一個資料夾建立 *AnkhSVN 安裝在要開發的電腦( Visual Studio 2010 SVN plugin)   結合VS可以commit、update 主要下載程式 檔案名稱: VisualSVN 官網: http://www.visualsvn.com/server/download/ 檔案名稱: TortoiseSVN  官網: http://tortoisesvn.tigris.org/ 檔案名稱: AnkhSVN 下載網址: http://ankhsvn.open.collab.net/ 參考連結 VisualSVN+TortoiseSVN(Client)佈署版本控制 ###詳細版 http://blog.yam.com/keynes0918/article/36722024 VisualSVN http://itman.pixnet.net/blog/post/29859149-visualsvn-%E7%89%88%E6%9C%AC%E6%8E%A7%E5%88%B6%E8%BB%9F%E9%AB%94 ------------------------------------------------------------------------------------------------------------ TortoiseSVN 最佳 SVN Client 軟體 ###不需要安裝VisualSVN,自訂一個資料夾,設成 SVN Repository(檔案庫) http://demo.tc/Post/591 TortoiseSVN設定排除簽入特定資料夾或檔案 http://www.petekcchen.com/2013/04/exclude-fold...

[T-SQL] 使用.mdf 和 .ldf 建立 DB

CREATE DATABASE TestDB ON (FILENAME = 'D:\04_sample_code\MacroWell_LibWebSample\App_Data\ TestDB .mdf'), (FILENAME = 'D:\04_sample_code\MacroWell_LibWebSample\App_Data\ TestDB _log.ldf') FOR ATTACH; 參考連結 http://msdn.microsoft.com/zh-tw/library/ms190209.aspx

[JavaScript] 多個 input Checkbox(Radiobutton) 像陣列取值

[HTML] <head runat="server">     <script type="text/javascript">         function chkvalue(theform) {                 var listLen = theform.namedata.length; //計算 namedata 數量             var str= ""             for (var i = 0; i < listLen; i++) {                 if (theform.namedata[i].checked) { //如果checked                     intr += theform.namedata[i].value + " " //取值                 }             }             if ( len(str) > 0 ) {                  alert("checked value : " + intr)             }                 }  ...

[Ajax] 利用 POST 同步傳值

//index.aspx [HTML] <head>  <script type="text/javascript">      function invoiceLog( d1 , d2 ) {          $.ajax({              type: 'POST',              contentType: 'application/json;',              data: '{data1:"' + d1 + '", data2:"' + d2 + '"}', //傳值              dataType: 'json',              async: false,              url: 'url.aspx/ FunctionName ', //url.aspx:傳值到指定的網址 ; FunctionName:呼叫.cs的function              success: function (result) {                  alert(result.d.RtnMsg);  //              }          });      }     </scr...