Posts

ASP.Net Upload, Paste and Save Image to Database (Binary)

Image
1. Image name = " SketchSrc1 " 2. Add a HiddenField to store image string ("hf...")    <asp:HiddenField ID="hf SketchSrc1 " runat="server" Value="" /> 3. Add an Image component ("img...") <asp:Image ID="img SketchSrc1 " runat="server" CssClass="img-thumbnail" ImageUrl="~/Images/NoImage.png"  Width="260px" Height="260px" Style="max-width: 300px; min-height: 100px; max-height: 600px" /> 4. Add "Upload", "Clear" and "Paste" button for new image ("file...", "clear...") <div>     <div id="divImgEd1" runat="server" visible="true">         <input type="file" accept=".jpg, .jpeg" name="image1" id="file SketchSrc1 "             onchange="loadFile(' SketchSrc1 ', event)" style="display: none;"...

Service Install Command

 MyService.exe /install /silent To uninstall the service application you open a command prompt and type:   MyService.exe /uninstall

Change IPv6 to IPv4

Image
  1.  netsh interface ipv6 show prefixpolicies 2.   netsh interface ipv6 set prefix ::/96 60 3 3.   netsh interface ipv6 set prefix ::ffff:0:0/96 55 4

Maintain scroll position on postback in modal popup

Image
A. Add 2 functions to store and set scroll position 1. storeScrollPositionEd(scrollValue) = save scroll position while scrolling 2. setScrollPositionEd() = set top position of div < script   type ="text/javascript" >     function storeScrollPositionEd(scrollValue) {         $( '#<% =hfEdScrollPosition.ClientID %>' ).val(scrollValue);     }     function setScrollPositionEd() {          $( "#divEdScroll" ).scrollTop($( '#<% =hfEdScrollPosition.ClientID %>' ).val());     } </ script >      B. Find the modal-body DIV name an Id and add onscroll function <div id=" divEdScroll " class="modal-body" onscroll ="storeScrollPositionEd(this.scrollTop);"> C. Add a HiddenField to store scroll value <asp: HiddenField ID=" hfEdScrollPosition " runat="server" Value=" 0 " /> D. call setScrollPositionEd() function after...

Javascript - Format an integer date (FormatDate)

Image
Convert an integer string (e.g. "/Date(1659369600000)/") to Date let dateTxt =  "/Date(1659369600000)/" ; let dateNew =   new Date(parseInt( dateTxt .substr(6))); document.getElementById("demo").innerHTML =  date.toDateString() + "  " + date.toLocaleTimeString(); result =  Thu Sep 22 2022 11:16:07 AM or let dateTxt = "/Date(1659369600000)/" ; let dateStr = dateStr.match(/\d+/); //"1659369600000" let dateInt = parseInt(dateStr); //1659369600000 let dateObj = new Date(dateInt); //convert integer to a date let dateFmt = dateObj.toShortFormat(); //"2-Aug-2022"

JSON JavaScriptSerializer - Length of string exceeds the value set on the maxJsonLength

Error Message Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property Solution Open "Web.config"   Add below code <configuration> <system.web.extensions> <scripting> <webServices> <!-- Update this value to set the max length --> <jsonSerialization maxJsonLength="2147483647" /> </webServices> </scripting> </system.web.extensions> </configuration>

HTTP Error 404.15 - Not Found

Image
Error Message : The Request filtering module is configured to deny a request where the query string is too long.