可能 5

  延续之前两个 AD 密码相关的 API,接着写了一个可以查询 AD 用户密码即将到期的 API,这篇就不再仔细写出环境细节,包括 Models、appsettings.json、Program.cs 等,因为是延续之前的项目,如有需要可以參考前面的文章

继续浏览 »

十二月 27

完成了《AD 密码验证》和《AD 密码修改》两个 API 后,接下来用 .NET MAUI Blazor 来编写桌面端程序。稍微了解了 Blazor 后,Feels so magical,It feels like stuffing a webpage into an app,When running, you can even see Edge-related components running in the 'Task Manager',And pressing F12 brings up the developer tools window! But this also raises some security concerns for me。Overall, though, it still feels quite unique,Fortunately, I'm more familiar with web syntax,Using Razor to design the UI,感觉亲切不少。

继续浏览 »

十二月 18

  继完成 验证 AD 密码的 API 后,接着尝试写修改密码的部分,跌跌撞撞的也总算完成。这次针对三个不同套件的写法做分享,而标题会提到 “修改自己 AD 密码” 是因为在写的过程中发现,某些方法需要有網域管理者的權限才能做到,所以這篇的範圍會限縮在只要用使用者自己的帳號密碼,You can complete the password change action。

继续浏览 »

十二月 3

Recently tried to write a program for changing AD account passwords through ASP.NET Core,The architecture is roughly to first have an AD authentication and some password modification Web API,Finally, write a desktop application,Allow users to change it themselves。This time completed the account password verification Web API,The program is as follows:

继续浏览 »

十一月 21

之前同事反映使用Google的QRCode API有时会无法使用,查了相关信息后,有了想通过编写这个 API 来学习 C# 的想法,花了一些时间摸索,还真被我弄出来了。此 API 的功能是在网址输入值,便可直接在浏览器生成 QRCode 图片,以下会以第一次编写 ASP.NET Core / C# 的新手角度来说明。

继续浏览 »

八月 25
<%# Eval("SDate", "{0:yyyy/MM/dd}") %>
// 0: 表示定義整個括號裡面的第 0 個變數要採用此日期格式。

// 以下為兩個變數的範例。
string s = String.Format("At {0}, the temperature is {1}°C.",
                         DateTime.Now, 20.4);
Console.WriteLine(s);
// Output similar to: 'At 4/10/2015 9:29:41 AM, the temperature is 20.4°C.'

【参考链接】

二月 22
//MVC3開始,新增Razer語法,不同於先前的<%...%>括號語法,使用At Sgin(@)敘述程式碼片段。

//在Razer檢視中,使用@*...*@進行程式註解。

//在程式碼中,要輸出內容,要加@或@(...)
//在html標籤中,要輸出內容,要加@
//在程式碼中,要輸出純文字,要加@:
@if(true)
{
    String strPrint = "這是測試輸出文字";
    @strPrint<br/>
    <span>strPring</span><br />
    <span>@strPrint</span><br />
}

@{string strl = "測試";}
@(strl)輸出文字<br />

@{ string strHtml1 = "<ul><li>項目一</li></ul>";}
@Html.Raw(strHtml1)<br />

二月 5
//在測試Controller與View時,如果因為設中斷點導致網頁顯示不完整而無法進行測試,
//可以試著點選"跳離函式(Shift+F11)",讓頁面完整顯示,以進行測試。

//先於Model設計好欄位變數等,
//再於Controller設定執行時,透過剛設計的Model樣板,進行各個變數的處理(遞交資料)
//如從網頁欄位A讀取資料到變數X,再把X送到網頁的欄位B
//最後於View設計各欄位的顯示情形
二月 4
//Controllers\HomeController.cs
public ActionResult Index()
        {
            TempData["Message"] = "修改此範本即可開始著手進行您的ASP.NET MVC應用程式。";
            return View();
        }
<!--Views\Home\Index.cshtml-->
<h2>@TempData["Message"]</h2>
二月 3
    //資料模型一對多關聯
    public class Guestbook
    {
        public int Id { get; set; }
        public string Content { get; set; }
        public DateTime CreateTime { get; set; }
        public Member Member { get; set; }
    }

    public class Member
    {
        [Key]
        public string Username { get; set; }
        public string Password { get; set; }
        public string Name { get; set; }
        public string Email { get; set; }

        public ICollection<Guestbook> Guestbook { get; set; }
    }
    //Code First 就是在Model定義好各欄位後,其他的Controller、View都會自動幫你產生,
    //很神奇的功能,讓你專注在寫Model的部分就好