Monday, April 30, 2012

WebResource.axd Error - "handler must be registered"

In some cases in appears due to corrupt installation of asp.net 4. Just add this


<system.webServer>
   <handlers>
      <add name="WebResource.axd" type="System.Web.Handlers.AssemblyResourceLoader" path="WebResource.axd" verb="GET,HEAD,POST,DEBUG" />
   </handlers>
</system.webServer>

Off you go!

Sunday, April 29, 2012

How to check a Constraint Exception in ASP.net (C#)


try
            {
                //statements
            }
            catch (ConstraintException cex)
            {
                throw;
            }
            catch (Exception ex)
            {
                throw;
            }
            /*
             * order matters
            */

Saturday, April 14, 2012

jQuery Countdown Timer


A jQuery plugin that sets a div or span to show a countdown to a given time.


Usage

  1. Include the jQuery library in the head section of your page.
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  2. Download and include the jQuery Countdown CSS and JavaScript in the head section of your page.
    <style type="text/css">@import "jquery.countdown.css";</style> 
    <script type="text/javascript" src="jquery.countdown.js"></script>
    Alternately, you can use the packed version jquery.countdown.pack.js (10.0K vs 30.1K), or the minified version jquery.countdown.min.js (12.6K, 4.3K when zipped).
  3. Connect the countdown functionality to your divs.
    $(selector).countdown({until: liftoffTime});
    You can include custom settings as part of this process.
    $(selector).countdown({until: liftoffTime, format: 'dHM'});

WebService: Request format is unrecognized for URL unexpectedly ending in {/MethodName}

All you need is to add the following to your web.config

<webServices>
     <protocols>
          <add name="HttpGet" />
          <add name="HttpPost" />
     </protocols>
</webServices>

and call the service this way

<script type="text/javascript">
$.ajax({
       type: "POST",
       url: "CatsService.asmx/GetCatsByID",
       data: "{id: " + li.attr("rel") + " }",
       contentType: "application/json; charset=utf-8",
       dataType: "json",
       success: function (o) {
           o = o.d;
           for (var i = 0; i < o.length; i++) {
           $('ul').append('<li><a href="javascript:void(0)">' + o[i].title + '</a></li>');
           }
       }
});
</script>

All is done

Thursday, April 5, 2012

Crystal Report Displaying Blank or Empty Page Without Any Errors

You created a lot of reports with crystal reports and everything was fine until you uploaded online. You get no error just a blank page with nothing on it. What has gone wrong, "Is it because there are no records in table", you ask yourself.
Well I myself got stuck with this error few days ago, so i created a blank report with just a custom static text in it, but nothing showed up. After a lot of searching I found out that it was because of a missing folder named "aspnet_client" which must be present in order for crystal reports to work properly.

So I copied this folder from c:/inetpub/wwwroot/aspnet_client into my website and voilĂ  it worked.

and for dot net framework 4.6 just copy existing framework folder in aspnet_client\system_web folder and the rename it to 4_81 or what ever version is installed on your system and your are done

To check your version click here
http://w3dproblems.dcense.com/2015/09/what-net-version-are-you-running-20-45.html

Wednesday, April 4, 2012

Crystal Reports : Retrieving the COM class factory for component with CLSID {GUID} failed due to the following error: 80070005

If your crystal report is working locally and not on server it is permission problem. If you are using plesk then plesk user IWAM_plesk(default) and IUSR_siteusername must have persmissions on a lot of things, so just give them permission to whole [C:\] drive and you are got to go. Have fun..

After your reports start working try removing permissions for security. 

Solutions:
  1. If possible change pool account to LocalSystem
  2. Compile x86 version of your web app or web site
  3. "Enable 32-bit Applications" should be true in your pool advanced settings



Sunday, April 1, 2012

Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692fbea5521e1304' or one of its dependencies. The system cannot find the file specified.

Just download and install both versions of Crystal reports(e.g. x86 and x64). If one of them is missing you will receive this error.

Download link

You can download the release packages for Visual Studio 2010 from the following locations:

On Development Machine
  • Complete Package (EXE) - Standard EXE installation package which installs SAP Crystal Reports for Visual Studio into the Visual Studio 2010 IDE
On Server Machine