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
標籤
  • .net core
  • contains
  • Data
  • query
  • 852
  • 278
  • LINE
  • qGhEOvLk
  • -9006
  • background
  • AD
  • ef
  • 774
  • 80
  • intlTelInp
  • sp_
  • 9518
  • HTTP 錯誤 50
  • youtube
  • 6286
  • 簡體字
  • There is
  • .
  • a
  • c
  • 82
  • image[t]
  • -6698
  • 效能
  • end[t]
  • IP21211211
  • json
  • wacs
  • expire
  • 題目
  • 3901
  • zindex
  • xml order
  • web. ORDER
  • vb轉c
  • uwinfo
  • uw原件
  • ubuntu
  • tuple
  • tim2121121
  • svn lock
  • sql accoun
  • separatedi
  • send mail
  • request,
搜尋 VB.NET 結果:
使用FtpWebRequest.ReName實現移動檔案功能
FtpWebRequest類別沒有提供移動檔案的命令,但是可以透過WebRequestMethods.Ftp.Rename達成相同效果的功能。

    FtpWebRequest ftp_Request = null/* TODO Change to default(_) if this is not a reference type */;
    FtpWebResponse ftp_Response = null/* TODO Change to default(_) if this is not a reference type */;
    string str_FtpAct = "XXX";
    string str_FtpPwd = "XXX";

    // Try to create backup folder. If folder already created, resume to backup. 
    try
    {
        ftp_Request = (FtpWebRequest)WebRequest.Create("D:/testfolder/backup");
        ftp_Request.Credentials = new NetworkCredential(str_FtpAct, str_FtpPwd);
        ftp_Request.Method = WebRequestMethods.Ftp.MakeDirectory;
        ftp_Response = ftp_Request.GetResponse();
    }
    catch (WebException ex_Web)
    {
        FtpWebResponse ftp_ResponseEx = ex_Web.Response;
        int int_ErrCode = ftp_ResponseEx.StatusCode;
        // 550: Access is denied, means directory already exist
        if (int_ErrCode != 550)
            Console.WriteLine("Create Folder Failed!");
    }

    try
    {
        ftp_Request = (FtpWebRequest)WebRequest.Create("D:/testfolder/test.txt");
        ftp_Request.Credentials = new NetworkCredential(str_FtpAct, str_FtpPwd);
        ftp_Request.Method = WebRequestMethods.Ftp.Rename;
        ftp_Request.RenameTo = "../testfolder/backup/test.txt";
        ftp_Response = (FtpWebResponse)ftp_Request.GetResponse();
    }
    catch (WebException webex)
    {
        // Get FTP Error code and exception status
        FtpWebResponse ftp_ResponseEx = webex.Response;
        int int_FtpCode = ftp_ResponseEx.StatusCode;
         // Do something
    }


    finally
    {
        if (ftp_Response != null)
            ftp_Response.Close();
    }
More...
高級水冷氣, 2020/8/4 下午 04:02:46
網站同時使用 C# 與 VB.net
由於早期網站都是VB.net寫的,若是直接換成 C#,就會耗費很多時間在轉換程式上
因此 ASP.NET 特別可以在同一網站同時寫 vb 跟 C#,方式是在 web.config compilation 加上設定
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
     <codeSubDirectories>
        <add directoryName="VB_Code"/>
        <add directoryName="CS_Code"/>
     </codeSubDirectories>
    </compilation>

也就是 VB.NET 的 code 就放到 ~\APP_Code\VB_Code 目錄
C# 的 code 就放到 ~\APP_Code\CS_Code 目錄
這樣做有兩點要注意
1.  Namespace 的命名,最好不要互相衝突, 要能夠區分出來
2.  VB_Code 與 CS_Code 放的位置有很大的影響, 因為牽涉到 compiler的先後順序,因為 VB_Code 在 CS_Code 在前面,所以 CS_Code可以叫用 VB_Code下的程式,但是 VB_Code 卻不能叫用 CS_Code 的程式,如果希望 VB_Code可以叫用 CS_Code的程式,就把設定換過來
    <compilation debug="true" defaultLanguage="c#" targetFramework="4.0">
     <codeSubDirectories>
        <add directoryName="CS_Code"/>
<add directoryName="VB_Code"/>
     </codeSubDirectories>
    </compilation>

缺點就是反過來 CS_Code不能使用 VB_Code的程式

基本上,若是舊的程式碼都在VB_Code 那就把 VB_Code 放到前面
More...
darren, 2017/5/10 下午 02:21:54
使用Linq取得CheckBoxList多選值
取得CheckBoxList多選值的方式:

【未使用Linq的寫法】

       Dim values = New List(Of String)()
       For Each item As ListItem In Me.CheckBoxList1.Items
             If item.Selected Then
                  values.Add(item.Value)
             End If
       Next

       Dim result = String.Join(",", values.ToArray(Of String)())
 

【使用Linq的寫法】

               Dim result = String.Join(",", Me.CheckBoxList1.Items.Cast(Of ListItem)() _
                                   .Where(Function(x) x.Selected) _
                                   .[Select](Function(x) x.Value).ToArray())

p.s. Linq需使用.NET Framework 3.5以上的版本
More...
candice, 2014/11/26 下午 04:57:30
IsNumeric 以及 Convert.ToInt32(char) 要注意的狀況
最近做一些int型別轉換的時候,發現一些現象,以後寫code的時候要注意

1. VB.NET IsNumeric 用逗號可以過,例如 IsNumeric("1234,5678") ==> True
   但是轉型別 CInt or Convert.ToInt32 就會出錯,所以用 IsNumeric 不是很保險,最好用 int.TryParse

2. Convert.ToInt32(char) 會抓出該 char 的 ascii code, 而不是該文字代表的數字
   Convert.ToInt32('9') ==> 57  (C# 用單引號代表是 char)
   Convert.ToInt32("9") ==> 9
   Convert.ToInt32('A') ==> 65  (C# 用單引號代表是 char)
   Convert.ToInt32("A") ==> error: 輸入字串格式不正確。
More...
darren, 2014/10/28 下午 07:10:28
Optional 參數使用 Date 格式所使用的預設值
VB.NET 時間類別因為沿襲自 VB,所以可以用 Date 型別宣告時間變數
實際上在 .NET 他等於 System.DateTime (C# 沒有 Date型別, 只有System.DateTime)
VB.NET 的 Date 可以設定常數,例如 #12/30/2014# (注意!格式是 MM/dd/yyyy, 用 #包起來),這是C#沒有的 
VB.NET 的 Date 也可以等於 Nothing (Nothing = #12:00:00 AM#)
C# 的 DateTime 可以指定為 default(DateTime) 但是不能 = null

由於 optional 參數必須指定預設值,因此當使用 Date 當作 optional 參數時就要設定以上說的值


Public Sub AddNewCustomer(customer As Customer, Optional dateAdded As Date = Nothing)
     If dateAdded = Nothing Then dateAdded = Now


// C# 4.0 以後的 function 已經可以使用 optional 參數
public void AddNewCustomer(Customer customer, DateTime dateAdded = default(DateTime))
     {
         if (dateAdded == default(DateTime)) dateAdded = DateTime.Now;
         ......


Public Sub AddNewCustomer(customer As Customer, Optional dateAdded As Date = #12/30/1899#)

 
More...
darren, 2014/4/1 下午 02:07:31
[程式提醒][VB.net]
當進行玩物件Update指令之後~不見得所有的資訊會跟著更新~
舉例:
ShippingInfo 在Update之後
ShippingInfo.FullAddress的內容為
Me.Post_Code & Me.County_Name & Me.City_Name & Me.Address

但是Me.County_Name & Me.City_Name的部分是用join出來的~
所以不會更新
因此地址部分會是錯誤的~

所以在執行update完之後~還是重新再new一次以保資料會是最新的~
More...
Doug, 2014/1/10 上午 10:41:04
~ Uwinfo ~