Monday, July 21, 2014

Problem in special characters When exporting to excel

HttpContext.Current.Response.Charset = "";
HttpContext.Current.Response.ContentEncoding = System.Text.Encoding.Default;

Thursday, May 1, 2014

Query to find the latest modified tables in the database

SELECT name 'Table',modify_date 'Last Modified Date'
FROM sys.tables
WHERE  DATEDIFF(D,modify_date, GETDATE()) < 200

Friday, April 25, 2014

IE10 settings

Add the following code in global.asax file

 public void Application_EndRequest(object sender, EventArgs e)
    {
        //Send compatibility header if IE 10 is used
        if (Request.RawUrl.ToLower().Contains(".aspx") && Request.Browser.MajorVersion >= 9)
        {
            Response.AddHeader("X-UA-Compatible", "IE=EmulateIE7");
        }
    }

Tuesday, December 24, 2013

WCF - Error 500.21 Handler "svc-Integrated" has a bad module "ManagedPipelineHandler" in its module list"

If you  see this error you havent installed the prerequistes for ASP.NET 4.

Try this

Open Visual Studio Command Prompt
Type the following:
aspnet_regiis.exe -i
Run the command
Try your service again...
Happy Face - it should be working :-)


This basically installs the necessary ASP pieces to get your service up and working!

Monday, October 28, 2013

QueryString Vs Session

  1. Query string parameters
    Pros:
    • Very simple to see what values are being passed.
    • Built-in .NET capability.
    • Useful for bookmark or favorites functionality in an application, because the page can be loaded up using the query string value; not dependent upon data being in a certain state in the application.
    Cons:
    • Each browser has a theoretical limit with Internet Explorer being the smallest at 2,048 characters.
    • Passing representation of objects is not possible with query strings (i.e. a list of Customer class objects).
    • Represents a potential security risk in that values are exposed. DO NOT pass any sensitive information in a query string.
  2. In-process session state variables
    Pros:
    • Built-in .NET capability.
    • Allows for storage of large and complex objects, such as list of Customer objects.
    • Resides in memory so you do not need to remember to keep on passing the value between page navigation.
    Cons:
    • It is volatile as it is in memory, must keep checking to see if data is actually there or not.
    • Can significantly increase the memory usage of your application; this is an issue if you are not the only application on your server.