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
標籤
  • InvalidOpe
  • TableSchem
  • js UNION A
  • 下載
  • -4293 UNIO
  • 網頁拖拉檔案上傳
  • -9250 UNIO
  • 848
  • 982
  • c?!a3?e??a
  • -5137 UNIO
  • UW.JSON.Wr
  • -4737 UNIO
  • 152
  • 追踪
  • 專案 UNION A
  • fancybox
  • timeout
  • 具有潛在危險 Req
  • 1021211211
  • MScpO3NFTG
  • 瀏覽您的usb 裝置
  • image,
  • -9829 UNIO
  • table
  • Viewstate
  • 要求長度
  • permitt
  • 搬家
  • -2484 UNIO
  • ajax212112
  • -8739 UNIO
  • 8053
  • @@s2efe
  • HTTP 錯èª
  • HTTP Error
  • unt2121121
  • groupby
  • MRTG 連æŽ
  • sa
  • -8329 UNIO
  • 發現有些圖片
  • 無法對應路徑
  • 遠端桌面服務
  • visualsvn
  • 要求已經逾時
頁數 1 / 6 下一頁
搜尋 windows 結果:
PrintDocument 另存成 PDF
如果列印主機是 windows server 主機,通常會有 "Microsoft Print to PDF" 名稱的印表機
那使用 Print Document 物件另存成 PDF code 如下
pd.PrinterSettings.PrinterName = "Microsoft Print to PDF";
pd.PrinterSettings.PrintToFile = true;
pd.PrinterSettings.PrintFileName = @"C:\TEMP\XPS\" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".pdf";
More...
darren, 2025/5/12 下午 04:36:12
win server 2022 架設 IIS6 的 SMTP 服務
如果網站需要有一個簡易的SMTP服務,最簡單的方式就是安裝SMTP服務


然後安裝後,記得要去 [服務] 把 [簡易郵件傳送通訊定(SMTP)]  啟動,並且記得要改為"自動啟動" (不然重開機不會啟動)
 
管理SMTP設定,要到這個介面的 IIS6 管理員


But, 如果你是用 win server 2022,就會出現掛掉無法編輯使用的狀況,不知為何win server 2022 會有這個奇怪的bug
請遵照下面步驟修改,就可以正常運作
1. Stop SMTPSVC service [Display Name: Simple Mail Transfer Protocol (SMTP)]
2. Stop IISADMIN service [Display name: IIS Admin Service]
3. Edit "C:\Windows\System32\inetsrv\MetaBase.xml"
4. Find: <IIsSmtpServer Location ="/LM/SmtpSvc/1"
5. Add (Settings are alphabetical): RelayIpList=""
6. Save file
7. Start IISAdmin Service
8. Start SMTPSVC service


開啟IIS6的管理介面後,還要設定一下 允許轉送清單,對於來源IP作管控
 
這樣大致上就可以正常運作
More...
darren, 2024/4/10 下午 03:18:35
Maui With SQLite
試了這兩個 Sample:

https://learn.microsoft.com/en-us/training/modules/store-local-data/4-exercise-store-data-locally-with-sqlite

和 

https://blazorhelpwebsite.com/ViewBlogPost/61

結果專案在 Windows 環境下都可以正常執行,但切換到 Android Emulator 就無法存檔。

在查了很多資料後,發現需要裝額外的 Package,需安裝的 Package 如下:

    <ItemGroup>
     <PackageReference Include="sqlite-net-pcl" Version="1.8.116" />
     <PackageReference Include="SQLiteNetExtensions.Async" Version="2.1.0" />
     <PackageReference Include="SQLitePCLRaw.bundle_green" Version="2.1.4" />
     <PackageReference Include="SQLitePCLRaw.core" Version="2.1.4" />
     <PackageReference Include="SQLitePCLRaw.lib.e_sqlite3" Version="2.1.4" />
     <PackageReference Include="SQLitePCLRaw.provider.dynamic_cdecl" Version="2.1.4" />
     <PackageReference Include="System.Data.DataSetExtensions" Version="4.5.0" />
    </ItemGroup>



其它的發現為:
1. 雙點專案,就可以開啟 csproj 檔案。下方的 ItemGroup 就是已安裝的 package

2. 可以把 chrome 連接到 Android Emulator 的方法,在網址列輸入以下指令:
chrome://inspect/#devices
More...
Bike, 2023/2/12 下午 05:09:11
sessionStorage 跨分頁無法讀取
問題:
在開出新分頁後,無法讀取 sessionStorage 的資料


可能原因:
Chrome 某個版本,Stop cloning sessionStorage for windows opened with noopener
a标签_blank默认 rel="noopener" ,所以a标签需要加入rel=“opener” 而才能像window.open("同源页面")这种方式新开的页面会复制之前的sessionStorage


解決方法:
開新分頁前,加入 rel=“opener”參數即可。
例:
<a href="http://..." target="_blank" rel="opener">Link</a>

$(".hlkPrint").click(function () {
    $("form").setPostDataToStorage();

    $("form").attr("rel", "opener");
    $("form").attr("target", "_blank");
    $("form").attr("action", "xxxxx.aspx");
    $("form").submit();
});





參考:
面试官:你确定多窗口之间sessionStorage不能共享状态吗???
More...
Reiko, 2022/12/1 下午 05:57:23
快速設定 SSL 協定的工具
文章參考: https://windowsreport.com/windows-server-enable-tls/

工具下載: https://www.nartac.com/Products/IISCrypto/Download
More...
Bike, 2022/5/5 下午 10:32:11
Windows AD 登入後,使用 DirectoryServices 取得使用者的資訊
今天解了一個 Bug.

在網路上找到AD 登入後, 使用 DirectoryServices 取得使用者的資訊的 Sample Code 如下:
            var name = User.Identity.Name.Split('\\')[1]; //*@I was getting name as domain\\name @*
            DirectorySearcher ds = new DirectorySearcher();
            ds.Filter = "(&(objectClass=user)(objectcategory=person)(name=" + name + "))";
            SearchResult userProperty = ds.FindOne();


User 反應有一些員工登入後會沒有查到使用者資訊,後來發現若是在 AD 中建立使用者時,使用者的名稱和登入帳號不一致的話,會抓不到使用者資料。

最後經過一翻努力後,終於找到要改用 "samaccountname" 來做為 Filter 的條件。

            var name = User.Identity.Name.Split('\\')[1]; //*@I was getting name as domain\\name @*
            DirectorySearcher ds = new DirectorySearcher();
            ds.Filter = "(&(objectClass=user)(objectcategory=person)(samaccountname=" + name + "))";
            SearchResult userProperty = ds.FindOne();
More...
Bike, 2022/4/18 下午 05:30:49
IIS 配合 AD (Active Directory) 認証, 使用 .Net 6.0
環境說明:

AD Server: dc1 (192.168.101.109)
PC: pc110 (192.168.101.110)
PC: pc111 (192.168.101.111)

第一步,把 PC 加入 AD, 這個算是基本操作,網路上說明很多, 就不再截圖了。不過在這裡還是遇到了第一個問題,解決過程請參考另一份文件: https://blog.uwinfo.com.tw/Article.aspx?Id=486

第二步,在 Visual Studio 的測試環境中測試:
一開始是使用 .Net 6.0 來實作,沒想到找到的文件都是 .Net Core 3.1 的,所以先用 .Net Core 3.1 實做了一次,後來改用 .Net 6.0 實作才成功。使用 .Net 6.0 實作的過程如下:

1. 建立一個 MVC 的標準專案: 
 
為了避免憑証問題,所以拿掉了 HTTPS 的設定


2. 改寫 launchSettings.json:
iisSettings 中的 windowsAuthentication 改為 True, anonymousAuthentication 改為 false。如下圖:
 
3. 修改 Program.cs, 加入以下四行指令:
builder.Services.AddAuthentication(IISDefaults.AuthenticationScheme);
builder.Services.AddAuthorization();
app.UseAuthentication();
app.UseAuthorization();
(注意: UseAuthentication 要加在 UseAuthentication 之後, VS 2022 應該會提示要新增 using Microsoft.AspNetCore.Server.IISIntegration;)
 
4. 在 HomeController 增加一個 Action, 以讀取驗証資料:

        [Route("GetAuthenticatedUser")]
        [HttpGet("[action]")]
        public IdentityUser GetUser()
        {
            return new IdentityUser()
            {
                Username = User.Identity?.Name,
                IsAuthenticated = User.Identity != null ? User.Identity.IsAuthenticated : false,
                AuthenticationType = User.Identity?.AuthenticationType
            };
        }

        public class IdentityUser
        {
            public string Username { get; set; }
            public bool IsAuthenticated { get; set; }
            public string AuthenticationType { get; set; }
        }
 
5. 啟動時記得要改用 IIS Express (感覺早上花了兩三個小時在為了這個問題打轉):


6. 執行結果:

第三步,在 IIS 中安裝網站:
1. 在安裝 IIS 時,記得要勾選 windows 驗證


2. 安裝 .Net 6.0 的 Hosting Bundle
https://dotnet.microsoft.com/en-us/download/dotnet/6.0
 
3. 新增網站:
主機名稱留空白 (AD 驗証在網域內好像不會使用指定的主機名稱,這個有待後續再做確認)


如果沒有刪除預設網站,會遇到警告,直接確認即可.


要把 Default Web Site 關閉,再啟動測試站
 
要啟動 windows 驗証: 
在 web.config 中增加 
      <security>
        <authentication>
          <anonymousAuthentication enabled="false" />
          <windowsAuthentication enabled="true" />
        </authentication>
      </security>



修改 applicationHost.config:

檔案位置: %windir%\system32\inetsrv\config\applicationHost.config
這兩地方的 Deny 改為 Allow
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<section name="windowsAuthentication" overrideModeDefault="Deny" />

 
參考文件: https://docs.microsoft.com/zh-tw/iis/get-started/planning-for-security/how-to-use-locking-in-iis-configuration

3. 可以取得登入資訊如下:

4. 從 Domain 中另一台主機來存取,不用登入,自動取得目前登入者的資訊。
 
5. 從非網域主機連線: 會要求認証
 

目前遇到問題: 在網域中的電腦只能用主機名稱登入,非網域的電腦,才能夠使用網址登入。

測試專案下載: https://github.com/bikehsu/AD60
 
More...
Bike, 2022/3/19 下午 09:10:08
分享印表機在windows更新後無法列印處理 Error 0x0000011b
今天協助小三敦化門市印表機問題,有一台分享印表機無法列印
處理方式要在分享印表機的主機上設定 registry + 服務的 printer spooler 重啟
請參考 https://www.youtube.com/watch?v=XouW14RUJxs
 
More...
darren, 2021/12/22 下午 05:31:42
匯出 let's encryption的憑証
https://www.alitajran.com/export-lets-encrypt-certificate-in-windows-server/

private 憑証所在位置:
C:\ProgramData\win-acme\acme-v02.api.letsencrypt.org\Certificates

憑証要安裝在"本機", 並記得允許匯出

Select A to manage renewals
Select D to show the renewal details
 
More...
Bike, 2021/12/20 上午 01:47:40
在 Hyper-V 上面安裝 windows server 2019, 但無法由 iso 開機
Disable secure boot in the VM menu, that'll fix it.



from: 
https://community.spiceworks.com/topic/1719453-hyper-v-gen-2-vm-unable-to-boot-from-iso-file-to-install-os
More...
Bike, 2021/8/5 下午 09:10:51
|< 123456 >|
頁數 1 / 6 下一頁
~ Uwinfo ~