2021年3月10日 星期三

[ASP.Net] A potentially dangerous Request.Form value was detected from the client 儲存HTML語法時遇到錯誤解決方法

利用ASP.NET 回存資料為HTML語法的時候,若是沒有特別處理會被誤判為有攻擊性的存檔

存檔時出現A potentially dangerous Request.Form value was detected from the client

狀況會如下圖顯示:



解決方法
直接在.aspx頁面最上面輸入<%@ Page  validateRequest="false" %>

如果原本就有出現,只需要將這一段加在其中即可 <%@ Page Title="" Language="VB"  AutoEventWireup="false"  validateRequest="false" %>


2021年2月2日 星期二

[ASP.Net] Maximum request length exceeded. 超過上傳檔案限制

如何解決在上傳檔案時遇到檔案過大的錯誤排解

ASP.NET讀取資料或上傳檔案時的預設檔案大小是4MB,因此會直接出現下面的情形

錯誤訊息如下:

Maximum request length exceeded.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Maximum request length exceeded.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.



解決方法:

在Web.Config中加上以下資訊

<configuration>
    <system.web>
        <httpRuntime maxRequestLength="1048576" />
    </system.web>
</configuration>

<system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>

2021年1月18日 星期一

[WINDOWS10] 清除Windows10暫存檔 加快電腦速度

 Windows10電腦用久了總是該清一清,尤其是看到C槽出現了紅色的一條,明明還有很足夠的空間,心裡就是不舒服



首先先來處理最常累積的暫存空間

-------------------------IE瀏覽器 可以清除的地方-----------------------

使用cmd執行或是powershell

上網瀏覽歷史

RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 1

上網產生的Cookies

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2

上網產生的Internet 臨時文件

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 8

網頁上的填表記錄

RunDll32.exe InetCpl.cpl, ClearMyTracksByProcess 16

-------------------------------個人暫存檔----------------------------------

手動刪除方式

路徑   C:\Users\你登入的帳號\AppData\Local\Temp


指令模式


Get-ChildItem C:\Users\你登入的帳號\AppData\Local\Temp -Recurse | Remove-Item -confirm:$false -force -Recurse -ErrorAction SilentlyContinue

-------------------------------OUTLOOK 暫存檔--------------------------------

手動刪除方式

Outlook 2010、Outlook2007 版本的路徑暫存檔

路徑  C:\Users\你登入的帳號\AppData\Local\Microsoft\Windows\INetCache\Content.Outlook\隨機產生的名稱

Outlook 2003版本的路徑暫存檔

路徑  C:\Users\你登入的帳號\AppData\Local\Microsoft\Windows\Temporary Internet Files\OLKFoldername


指令模式

 Get-ChildItem 上述路徑 -Recurse | Remove-Item -Confirm:$false -force -Recurse 

2021年1月15日 星期五

SQL 使用指令重建index

當少了SQL admin的時候,還是有些方法是可以執行我想要做到的事情

所以當我必須重作index的時候,可以利用指令的方式,搭配夜間排程來執行

1.首先將下面script存成檔案,命名為Execute_RebulidIndex.sql

2020年9月11日 星期五

[EXCEL] 快速鍵 用鍵盤快速按出今天日期今天時間

利用EXCEL 想要記錄每天當天的日期 或者是 當下的時間 可以利用快速鍵完成


如果想要用鍵盤快速得到下面的樣式


可以先按下 Ctrl + ;  會出現今天的日期

2020/8/24


接著按下  Ctrl + Shift + ;  會出現現在的時間

9:18


趕快來自己試試看吧 ! 

背起來後這是個方便的小密技唷!


2020年9月10日 星期四

[EXCEL][OFFICE2013]如何在Excel裡面夾帶檔案

第一步

在上方Tab選擇INSERT(插入)按下Object(物件)




第二步

選擇要夾帶的檔案

勾選Display as icon


這樣就可以囉!



2020年9月9日 星期三

[SQL]列出所有TABLE還有使用量 List tables and used size in SQL Server database

有時候這種指令還是蠻好用的,可以一次找出那些TABLE使用量是最高的

語法如下:

select schema_name(tab.schema_id) + '.' + tab.name as [table], 

    cast(sum(spc.used_pages * 8)/1024.00 as numeric(36, 2)) as used_mb,

    cast(sum(spc.total_pages * 8)/1024.00 as numeric(36, 2)) as allocated_mb

from sys.tables tab

    inner join sys.indexes ind 

        on tab.object_id = ind.object_id

    inner join sys.partitions part 

        on ind.object_id = part.object_id and ind.index_id = part.index_id

    inner join sys.allocation_units spc

        on part.partition_id = spc.container_id

group by schema_name(tab.schema_id) + '.' + tab.name

order by sum(spc.used_pages) desc

參考資料

https://dataedo.com/kb/query/sql-server/list-of-tables-by-their-size