Posts

Showing posts from March, 2025

Custom script for DOM debugging

 (function() {   const eventTypes = [     'click', 'dblclick', 'mousedown', 'mouseup', 'mouseover', 'mouseout',     'keydown', 'keypress', 'keyup',     'focus', 'blur', 'change', 'input',     'submit', 'reset',     'focusin', 'focusout'   ];      const logEvent = function(e) {     const timestamp = new Date().toISOString().slice(11, -1);     const target = e.target.tagName +        (e.target.id ? '#' + e.target.id : '') +        (e.target.className ? '.' + e.target.className.split(' ')[0] : '');          // Get value for input-like elements     let valueInfo = "";     if (e.target.value !== undefined) {       // Handle empty strings specially to make them visible       const displayValue = e.target.value === "" ? "<empty string>" : e.target.value;       v...

SQL Server Stored Procedure Encryption

Image
Today I discovered how to encrypt stored procedures in SQL Server. This is useful knowledge for protecting sensitive business logic or intellectual property in database code. What I Learned SQL Server provides a simple WITH ENCRYPTION option when creating or altering stored procedures Once encrypted, the procedure's code cannot be viewed through SSMS or using sp_helptext Even database administrators cannot view the encrypted code through standard means The procedure remains executable for users with proper permissions Code Example CREATE PROCEDURE dbo . SecureStoredProcedure WITH ENCRYPTION AS BEGIN -- This code will be hidden from view SELECT 'Protected business logic' AS Result ; END Important Considerations Always keep an unencrypted backup of your code in a secure location This encryption is primarily to prevent casual viewing, not a high-security measure There's no built-in way to decrypt the procedure once it's encrypted Users ...

Browser Caching and ASP.NET

The Problem Encountered DataTables error for a recently modified column 'DDI' Changes made to code weren't reflected in the browser despite deployment Error message: "DataTables warning: table id=gridTotalsLink - Requested unknown parameter 'DDI' for row 0, column 3" Root Cause: Browser Caching Browser was using cached version of JavaScript files for 7 days (cache-control: max-age=604800) The 7-day cache setting came from web.config: <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00" /> Static files were being handled by IIS before reaching my ASP.NET cache-control settings The Simple Solution: Cache Busting Add a version query parameter to script tags: <script src="~/Scripts/app/Home/Index.js?v=20250313"></script> This forces browsers to treat it as a new resource without changing the actual file Server ignores query parameters for static files but browsers use the full URL ...