Sunday, July 29, 2012

Send multiple parameters in jquery ajax in

Here I am going explain how to send  multiple parameters using JQuery or JSON in
If we want to send or pass multiple parameters using JSON or JQuery in we need to declare it like as shown below in our aspx page under <script> tag.
Let's write a simple code to understand it.

Thursday, July 26, 2012

Alter Encrypted Stored Procedure

How to Alter Encrypted Stored Procedure ?

Yesterday i wrote about how to write a Stored procedure in a encrypted manner. If Stored Procedure or User Defined Function are created WITH ENCRYPTION keyword then  is not possible to decrypt it using SQL Server commands. It is always advised to save a copy of the script used to create the SP or UDF on other media source than SQL Server.

Encrypted Stored Procedure

How  to write a encrypted Stored Procedure?

Sometimes we  need to write a stored procedure so that alternative user cannot see written text within  Stored Procedure.

Even you may be ineffective to see the text of the encrypted Stored Procedure in SQL Server  Activity Monitor moreover as by using Sp_helptext SpName methodology.

So what's the command to write encrypted stored procedure.

Let See

Tuesday, July 24, 2012

What's New in ASP.NET 4.5 and Visual Web Developer 11 Developer Preview

This document lists options and enhancements that are being introduced in ASP.NET 4.5. It conjointly lists enhancements being created for internet development in Visual Studio (Visual internet Developer).

  1.     ASP.NET Core Runtime and Framework
  2.     Asynchronously Reading and Writing HTTP Requests and Responses.
  3.     Enhancements to HttpRequest handling
  4.     Asynchronously flushing a response
  5.     Support for await and Task-Based Asynchronous Modules and Handlers
  6.     Asynchronous HTTP modules
  7.     Asynchronous HTTP handlers
  8.     New ASP.NET Request Validation options
  9.     Deferred ("lazy") request validation
  10.    Support for unvalidated requests.

Monday, July 23, 2012




The UNION command is employed to pick connected info from 2 tables, very similar to the be a part of command. However, when using the UNION command all selected columns have to be compelled to be of constant knowledge kind. With UNION, solely distinct values are selected.


The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.

The distinction between Union and Union all is that Union all won't eliminate duplicate rows, instead it simply pulls all rows from all tables fitting your question specifics and combines them into a table.

A UNION statement effectively will a pick DISTINCT on the results set. If you recognize that each one the records came back are distinctive from your union, use UNION ALL instead, it offers faster results.

Sunday, July 22, 2012

Stored Procedure and Transactions

Stored Procedure and Transactions

I simply overheard the subsequent statement – “I don't use Transactions in SQL as i exploit Stored Procedure“.

I simply realized that there are numerous misconceptions regarding this subject. Transactions has nothing to try and do with Stored Procedures. Let me demonstrate that with a straightforward example.

USE tempdb
-- produce three check Tables
-- produce SP
VALUES ('a')
-- Execute SP
-- SP can error out
-- Check the Values in Table

Now, the most purpose is: If Stored Procedure is transactional then, it ought to roll back complete transactions when it encounters any errors. Well, that doesn't happen during this case, that proves that Stored Procedure doesn't solely give simply the transactional feature to a batch of T-SQL.

Send Asynchronous Email in

Send Asynchronous Email in

when you are sending bulk email using then sending email using traditional parameter would be terribly time consuming as a result of we'll ought to expect the execution of smtp.send().but in Async methodology Email are going to be delivered in background and that we also can manage the output of email by Async handler.

Here i'm providing a code snippet to send email in Async manner.

using System.Web.Util;

     static void SendAsyncEmail()
            MailMessage cnetcode_mail = new MailMessage();            
            cnetcode_mail.From = new MailAddress("");
            cnetcode_mail.Subject = "your subject goes here";
            cnetcode_mail.Body = "Body content of the email.";
            //send the message
            SmtpClient smtp = new SmtpClient("Outgoing SMTP IP"); //Enter mail server address           
            object userState = cnetcode_mail;            
            smtp.SendCompleted += new SendCompletedEventHandler(SmtpClient_OnCompleted) 
            smtp.SendAsync( cnetcode_mail, userState );

Thursday, July 19, 2012

Unable to connect to Sql Server

If you are unable to connect your SQL Server from outside or from web.config
then  you must check this setting.

open your Sql Server and right click on your connected server and go to properties.
click security from left hand side and ensure
Sql server and windows authentication mode is enable.


Tips to Speed up SQL Query

Almost Every website data is stored in a database and served to visitors upon request. Databases are very fast, but there is lots of things that we need to  enhance  speed and make sure not to waste any server resources. In this article, I am suggesting you 10  tips to optimize and speed up your Sql query.

1. Do not Select column that we do not need.

    A very common practice is to use Select * from tablename.
    It's better to select column which you need in output.

2. Avoid using Cursor , use while loop instead of Cursor.

3. Avoid using Sql statement in a loop.It's takes a lot of resource.

4.Use Join instead of Subqueries.
    (SELECT MAX(created)
    FROM posts
    WHERE book_id =
AS latest_post FROM books a

However subqueries are useful, they often can be replaced by a join, which is definitely faster to execute.
SELECT, MAX(p.created) AS latest_post
FROM books 
INNER JOIN posts p
    ON ( = p.book_id)

Enable IIS 7.0 Compression

To enable Compression at IIS 7.0

Enabling IIS Compression can improve performance of a web site.
you can enable both
A) Static Compression
B) Dynamic Compression

Follow these steps to enable it:-
Goto run and type intemgr => it will open up your IIS => then select your website from left hand side pane.
Now at right side you will see an option Compression just click it twice and here we go.
Check Static and dynamic compression.
[note: By default dynamic compression is disabled you need to enable dynamic compression from server manager in administrative panel]


Speeding Up Your Web Site

To speed up website we need to take care about certain things.
i am providing several points which you should take care while developing and deploying your website.

1. Minimize HTTP request
2. Use a CDN for static file.
3. Add an Expire Header.
4. Gzip or compress site text. here is the link for  Gzip Compression
5. Put CSS at top and script at the bottom.
6.minimize javascript.
7. Avoid duplicate Scripts.
8.Configure Etag.
9.Avoid Redirects.
10. Flush Buffer early

Definately i will elaborate on these tips or you can Google around to find some useful info!!!



What is Favicon ?

when you open up a browser and visit a site you will see an icon on the tab

this is called favicon.Every time when we request a page it search for favicon.
It is a best practice to use favicon in also optimize performance of website a bit.
to use favicon just add this under <Head> tag

<link rel="shortcut icon" href="URL or path of your icon file"/>
Remember to replace
URL or path of your icon file file with your icon file's url.

Enjoy programming...:))

Wednesday, July 18, 2012

Visual Studio Build error

If you are facing problem to build your visual studio Application even if there was no syntax error then don't worry you just need to delete some temporary files.

Delete cache file of your project if problem in building.


C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files


Unlimited Connection TimeOut in and SQL

Sometimes when we are executing a Stored procedure from which takes a lot of time,which leads to connection TimeOut problem.
There are two ways to increase connection TimeOut.
1) From Web.config
2) From Sql Server database setting.

For got to web.config connection string and set Connection timeout Property to 0(Zero).

For Sql Server right click on Server => Properties . then a server properties page will open , from left hand side menu select Connections and set Remote query timeout to 0.

I hope somebody will find this useful.

How to set gzip/deflate compression in .net.

To enable Gzip and deflate compression in website, you just need to place this code in global.asax.
however you can also apply this setting to IIS level.

void Application_PreRequestHandlerExecute(object sender, EventArgs e)
            HttpResponse Response = HttpContext.Current.Response;
            String AcceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"];