Archive for the ‘ASP.NET’ Category

check canvas empty or not <“canvas11″ height=”200px” width=”200px”> <asp:Button runat=”server” ID=”btn1″ Text=”Save” OnClientClick=”checkcanvas();” /> <script type=”text/javascript”> function checkcanvas() { var i = isCanvasTransparent(); //i =true if canvas empty //i =false if canvas has image } function isCanvasTransparent() { var canvas1 = document.getElementById(‘canvas11’); // true if all pixels Alpha equals to zero var ctx = canvas1.getContext(“2d”); […]

copy a file into another folder asp .net

Posted: 25th July 2012 by erpriyana in ASP.NET

copy a file into another folder asp .net string targetFolder = Server.MapPath(“~/PDF”); System.IO.FileInfo fi = new System.IO.FileInfo(Server.MapPath(“~/Bookmark.pdf”)); fi.CopyTo(System.IO.Path.Combine(targetFolder, fi.Name), true);

Prevent HttpContext Current to be null WCF service NET add following code in web.config file….. <configuration> <system.serviceModel> <serviceHostingEnvironment aspNetCompatibilityEnabled=”true” /> </system.serviceModel> </configuration>