tag:blogger.com,1999:blog-38595370014619029562024-03-13T03:53:50.941-07:00C Net CodeA blog about Microsoft Technology like ASP.NET,C#.NET,SQL Server, Ajax that majorly focus on code, tips ,tweaks and tricks.Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.comBlogger15125tag:blogger.com,1999:blog-3859537001461902956.post-16864631368459518462012-07-29T22:05:00.004-07:002012-07-29T22:08:17.962-07:00Send multiple parameters in jquery ajax in asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<h3 class="post-title entry-title">
</h3>
<div class="post-footer-line post-footer-line-3">
<span class="post-location">
</span>
</div>
<b><u><span style="font-family: Verdana,sans-serif; font-size: 10pt;"></span></u></b>
<br />
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">Here
I am going explain how to send multiple parameters using JQuery or JSON in
asp.net.</span><b><span style="font-family: Verdana,sans-serif; font-size: 10pt;"></span></b></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">If
we want to send or pass multiple parameters using JSON or JQuery in asp.net we
need to declare it like as shown below in our aspx page under <script> tag.</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">Let's write a simple code to understand it.</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<a href="http://www.blogger.com/blogger.g?blogID=3859537001461902956" name="more"></a><br />
<a name='more'></a><br />
<table border="1" cellpadding="0" class="MsoNormalTable" style="border: dashed brown 1.0pt; mso-cellspacing: 1.5pt; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;">
<tbody>
<tr>
<td style="border: none; padding: .75pt .75pt .75pt .75pt;"><div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">$.ajax({</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">type: <span style="color: #a31515;">"POST"</span>,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">contentType: <span style="color: #a31515;">"application/json;charset=utf-8"</span>,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">url: <span style="color: #a31515;">"SavecNetCode.aspx/SaveData"</span>,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">data: JSON.stringify({title: <span style="color: #a31515;">'value1'</span> ,ID: <span style="color: #a31515;">'value2'</span>
}),</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">dataType: <span style="color: #a31515;">"json"</span>,</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">success: <span style="color: blue;">function</span>(data)
{</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">$(<span style="color: #a31515;">'lbltxt'</span>).text(data.d);</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">},</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">error: <span style="color: blue;">function</span>(result)
{</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">alert(<span style="color: #a31515;">"error"</span>);</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">});</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
</td>
</tr>
</tbody></table>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">Here <b>JSON.stringify</b> is used to encode the
parameters in JSON format and our webmethod will be like as shown below</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<b><u><span style="font-family: Verdana,sans-serif; font-size: 10pt;">C#
Code</span></u></b><span style="font-family: Verdana,sans-serif; font-size: 10pt;"></span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
</div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">[<span style="color: #2b91af;">WebMethod</span>]</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Verdana,sans-serif; font-size: 10pt;">public</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;"> <span style="color: blue;">static</span> <span style="color: blue;">string</span> SaveData(<span style="color: blue;">string</span>
title,<span style="color: blue;">string</span> </span><span style="font-family: Verdana,sans-serif; font-size: 10pt;">ID</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;">)</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Verdana,sans-serif; font-size: 10pt;">string</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;"> str = </span><span style="font-family: Verdana,sans-serif; font-size: 10pt;"></span><span style="font-family: Verdana,sans-serif; font-size: 10pt;">ID</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;">+</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;"> title</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;">;</span></div>
<div class="MsoNormal" style="margin-bottom: 0.0001pt;">
<span style="color: blue; font-family: Verdana,sans-serif; font-size: 10pt;">return</span><span style="font-family: Verdana,sans-serif; font-size: 10pt;"> str;</span></div>
<span style="font-family: Verdana,sans-serif; font-size: 10pt;">}</span><br />
<br />
<br />
<span style="font-family: Verdana,sans-serif; font-size: 10pt;"><span style="color: red;">:)) </span></span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com18tag:blogger.com,1999:blog-3859537001461902956.post-20875589824775483032012-07-26T21:14:00.001-07:002012-07-26T21:15:00.100-07:00Alter Encrypted Stored Procedure<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to Alter Encrypted Stored Procedure ? </b><br />
<br />
Yesterday i wrote about how to write a <a href="http://cnetcode.blogspot.in/2012/07/encrypted-stored-procedure.html" target="_blank">Stored procedure in a encrypted manner</a>. 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.<br />
<br />
<a name='more'></a>yesterday i wrote a script and now i want to modify my script.As i already say keep your original script, in my case my script was<br />
<br />
<blockquote class="tr_bq">
CREATE PROCEDURE MyEncrypteSP_cnetcode<br />
WITH ENCRYPTION<br />
AS<br />
SELECT *<br />
FROM cnetcode.user<br />
UNION<br />
SELECT *<br />
FROM cnetcode.user<br />
GO<br />
-- Execute SP<br />
EXEC MyEncrypteSP_cnetcode<br />
GO</blockquote>
To Alter Above Script just replace Alter command with Create and add your additional line of code.<br />
Like this:-<br />
<br />
<blockquote class="tr_bq">
ALTER PROCEDURE MyEncrypteSP_cnetcode<br />
WITH ENCRYPTION<br />
AS<br />
SELECT *<br />
FROM cnetcode.user<br />
UNION<br />
SELECT *<br />
FROM cnetcode.user</blockquote>
<br />
SELECT * FROM CNETCODE.NEWTABLE <br />
<blockquote class="tr_bq">
GO<br />
-- Execute SP<br />
EXEC MyEncrypteSP_cnetcode<br />
GO</blockquote>
<br />
<span style="color: red;">:)) </span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com13tag:blogger.com,1999:blog-3859537001461902956.post-18906386263400162622012-07-26T02:32:00.004-07:002012-07-26T04:28:34.383-07:00Encrypted Stored Procedure<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How to write a encrypted Stored Procedure?</b><br />
<br />
Sometimes we need to write a stored procedure so that alternative user cannot see written text within Stored Procedure.<br />
<br />
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.<br />
<br />
So what's the command to write encrypted stored procedure.<br />
<br />
Let See<br />
<a name='more'></a><br />
<br />
CREATE PROCEDURE MyEncrypteSP_cnetcode<br />
WITH ENCRYPTION<br />
AS<br />
SELECT *<br />
FROM cnetcode.user<br />
UNION<br />
SELECT *<br />
FROM cnetcode.user<br />
GO<br />
-- Execute SP<br />
EXEC MyEncrypteSP_cnetcode<br />
GO<br />
<br />
<b style="color: red;">:)) </b></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com17tag:blogger.com,1999:blog-3859537001461902956.post-28545212672742199022012-07-24T21:26:00.004-07:002012-07-24T21:26:46.089-07:00What's New in ASP.NET 4.5 and Visual Web Developer 11 Developer Preview<div dir="ltr" style="text-align: left;" trbidi="on">
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).<br /><br /><br />
<ol style="text-align: left;">
<li> ASP.NET Core Runtime and Framework</li>
<li> Asynchronously Reading and Writing HTTP Requests and Responses.</li>
<li> Enhancements to HttpRequest handling</li>
<li> Asynchronously flushing a response</li>
<li> Support for await and Task-Based Asynchronous Modules and Handlers</li>
<li> Asynchronous HTTP modules</li>
<li> Asynchronous HTTP handlers</li>
<li> New ASP.NET Request Validation options</li>
<li> Deferred ("lazy") request validation</li>
<li> Support for unvalidated requests.<a name='more'></a></li>
<li> Anti-XSS Library</li>
<li> Support for WebSockets Protocol</li>
<li> Bundling and Minification</li>
<li> Performance enhancements for internet Hosting</li>
<li> Key Performance Factor needs for brand new Performance options</li>
<li> Sharing Common Assemblies</li>
<li> Using multi-Core JIT compilation for faster startup</li>
<li> Tuning garbage assortment to optimize for memory</li>
<li> Prefetching for internet applications</li>
<li> ASP.NET internet Forms</li>
<li> Strongly Typed information Controls</li>
<li> Model Binding</li>
<li> choosing information</li>
<li> price suppliers</li>
<li> Filtering by values from an impression</li>
<li> HTML Encoded Data-Binding Expressions</li>
<li> Unobtrusive Validation</li>
<li> HTML5 Updates</li>
<li> ASP.NET MVC 4</li>
<li> ASP.NET websites two</li>
<li> New and Updated website Templates</li>
<li> Improved Input Validation</li>
<li> Resource Management</li>
<li> Enhanced Membership and Authentication</li>
<li> Side-by-side Execution</li>
<li> Mobile Device Rendering</li>
<li> The Maps Helper</li>
<li> Visual internet Developer eleven Developer Preview.</li>
<li> HTML Editor sensible Tasks</li>
<li> WAI-ARIA support</li>
<li> New HTML5 snippets</li>
<li> Extract to user management</li>
<li> IntelliSense for code nuggets in attributes</li>
<li> Automatic renaming of matching tag after you rename a gap or closing tag</li>
<li> Event handler generation</li>
<li> sensible indent</li>
<li> Auto-reduce statement completion</li>
<li> JavaScript Editor</li>
<li> Code outlining</li>
<li> Brace matching</li>
<li> Attend Definition</li>
<li> ECMAScript5 support</li>
<li> DOM IntelliSense</li>
<li> VSDOC signature overloads</li>
<li> Implicit references</li>
<li> CSS Editor</li>
<li> Auto-reduce statement completion</li>
<li> Hierarchical indentation</li>
<li> CSS hacks support</li>
<li> Vendor specific schemas (-moz-, -webkit)</li>
<li> Commenting and uncommenting support</li>
<li> Color picker</li>
<li> Snippets</li>
<li> Custom regions</li>
<li> Page Inspector</li>
<li> Publishing</li>
<li> Publish profiles</li>
<li> ASP.NET precompilation and merge</li>
<li> IIS specific</li>
</ol>
<br />
<a href="http://www.asp.net/vnext/overview/whitepapers/whats-new" target="_blank">For Detailed information visit this link.</a><br />
<br />
<span style="color: red;">:))</span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com10tag:blogger.com,1999:blog-3859537001461902956.post-54358887381216468442012-07-23T21:21:00.001-07:002012-07-23T21:21:19.508-07:00UNION VS UNION ALL<div dir="ltr" style="text-align: left;" trbidi="on">
<b>UNION VS UNION ALL</b><br />
<br />
<b>UNION</b><br />
<br />
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.<br />
<br />
<br />
<b>UNION ALL</b><br />
<br />
The UNION ALL command is equal to the UNION command, except that UNION ALL selects all values.<br />
<br />
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.<br />
<br />
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.</div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com11tag:blogger.com,1999:blog-3859537001461902956.post-88033908670311676002012-07-22T21:03:00.000-07:002012-07-22T21:03:08.569-07:00Stored Procedure and Transactions<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Stored Procedure and Transactions</b><br />
<br />
I simply overheard the subsequent statement – “I don't use Transactions in SQL as i exploit Stored Procedure“.<br />
<br />
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.<br />
<br />
USE tempdb<br />
GO<br />
-- produce three check Tables<br />
CREATE TABLE TABLE_1 (ID INT);<br />
CREATE TABLE TABLE_2 (ID INT);<br />
CREATE TABLE TABLE_3 (ID INT);<br />
GO<br />
-- produce SP<br />
CREATE PROCEDURE TestSP<br />
AS<br />
INSERT INTO TABLE_1 (ID)<br />
VALUES (1)<br />
INSERT INTO TABLE_2 (ID)<br />
VALUES ('a')<br />
INSERT INTO TABLE_3 (ID)<br />
VALUES (3)<br />
GO<br />
-- Execute SP<br />
-- SP can error out<br />
EXEC TestSP<br />
GO<br />
-- Check the Values in Table<br />
SELECT *<br />
FROM TABLE_1;<br />
SELECT *<br />
FROM TABLE_2;<br />
SELECT *<br />
FROM TABLE_3;<br />
GO<br />
<br />
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.<br />
<a name='more'></a><br />
Let’s see the result terribly quickly.<br />
<br />
It is terribly clear that there have been entries in table1 that don't seem to be shown within the subsequent tables. If SP was transactional in terms of T-SQL question Batches, there would be no entries in any of the tables. If you would like to use Transactions with Stored Procedure, wrap the code around with BEGIN TRAN and COMMIT TRAN.<br />
<br />
The example is as following.<br />
CREATE PROCEDURE TestSPTran<br />
AS<br />
BEGIN TRAN<br />
INSERT INTO TABLE_1 (ID)<br />
VALUES (11)<br />
INSERT INTO TABLE_2 (ID)<br />
VALUES ('b')<br />
INSERT INTO TABLE_3 (ID)<br />
VALUES (33)<br />
COMMIT<br />
GO<br />
-- Execute SP<br />
EXEC TestSPTran<br />
GO<br />
-- Check the Values in Tables<br />
SELECT *<br />
FROM TABLE_1;<br />
SELECT *<br />
FROM TABLE_2;<br />
SELECT *<br />
FROM TABLE_3;<br />
GO</div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com4tag:blogger.com,1999:blog-3859537001461902956.post-64602123596929396962012-07-22T00:40:00.000-07:002012-07-22T00:40:05.348-07:00Send Asynchronous Email in Asp.net<div dir="ltr" style="text-align: left;" trbidi="on">
<b>Send Asynchronous Email in Asp.net?</b><br />
<br />
when you are sending bulk email using Asp.net 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.<br />
<br />
Here i'm providing a code snippet to send email in Async manner.<br />
<br />
using System.Web.Util;<br />
<br />
static void SendAsyncEmail()<br />
<pre class="csharp" title="Click to copy to clipboard"> {
MailMessage cnetcode_mail = new MailMessage();
cnetcode_mail.From = new MailAddress("RD@cnetcode.com");
cnetcode_mail.To.Add("you@cnetcode.com");
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) </pre>
<blockquote class="tr_bq">
<pre class="csharp" title="Click to copy to clipboard"> smtp.SendAsync( cnetcode_mail, userState );
}</pre>
</blockquote>
<br />
<a name='more'></a><br />
<blockquote class="tr_bq">
<pre class="csharp" title="Click to copy to clipboard"> public static void SmtpClient_OnCompleted(object sender, AsyncCompletedEventArgs e)
{
if (e.Cancelled)
{
Console.WriteLine("Send canceled.");
}
if (e.Error != null)
{
Console.WriteLine("Error occurred when sending mail [{0}] ",</pre>
</blockquote>
<br />
<blockquote class="tr_bq">
<pre class="csharp" title="Click to copy to clipboard"> e.Error.ToString());
}
else
{
Console.WriteLine("Mail sent.");
}
}</pre>
</blockquote>
<br />
<span style="color: red;">:))</span> </div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com2tag:blogger.com,1999:blog-3859537001461902956.post-37353816870497679342012-07-19T23:44:00.001-07:002012-07-20T22:26:25.969-07:00Unable to connect to Sql Server<div dir="ltr" style="text-align: left;" trbidi="on">
If you are unable to connect your SQL Server from outside or from Asp.net web.config<br />
then you must check this setting.<br />
<br />
open your Sql Server and right click on your connected server and go to properties.<br />
click security from left hand side and ensure<br />
Sql server and windows authentication mode is enable.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://3.bp.blogspot.com/-ldnYSF2r2ck/UAj8SBRRvTI/AAAAAAAAAA0/cfZXw15JW9g/s1600/sql.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="548" src="http://3.bp.blogspot.com/-ldnYSF2r2ck/UAj8SBRRvTI/AAAAAAAAAA0/cfZXw15JW9g/s640/sql.png" width="640" /></a></div>
<span style="color: red;">:))</span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com5tag:blogger.com,1999:blog-3859537001461902956.post-61915467807157904652012-07-19T21:45:00.004-07:002012-07-19T23:20:24.937-07:00Tips to Speed up SQL Query<div dir="ltr" style="text-align: left;" trbidi="on">
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.<br />
<br />
1. Do not Select column that we do not need.<br />
<br />
A very common practice is to use Select * from tablename.<br />
It's better to select column which you need in output. <br />
<br />
2. Avoid using Cursor , use while loop instead of Cursor.<br />
<br />
3. Avoid using Sql statement in a loop.It's takes a lot of resource.<br />
<br />
4.Use Join instead of Subqueries.<br />
<blockquote class="tr_bq">
<br />
<pre class="brush: sql">SELECT a.id,
(SELECT MAX(created)
FROM posts
WHERE book_id = a.id)
AS latest_post FROM books a</pre>
</blockquote>
<br />
<blockquote class="tr_bq">
However subqueries are useful, they often can be replaced by a join, which is definitely faster to execute.<br />
<pre class="brush: sql">SELECT a.id, MAX(p.created) AS latest_post
FROM books
a
INNER JOIN posts p
ON (a.id = p.book_id)
GROUP BY a.id</pre>
</blockquote>
<br />
<a name='more'></a><br /><br />
5. Use Union instead of OR<br />
<br />
<div style="text-align: justify;">
6. Use <b>Set No Count On </b>at the beginning of Stored procedure and <b>Set No Count Off </b>before ending of Stored procedure.</div>
<div style="text-align: justify;">
<br /></div>
7. Use indexing on Table. Create clustered or non-clustered index on those column which you require frequently in sql query. <br />
<br />
8.Do not Name Your Stored Procedures with ‘sp_’ at the start.<br />
<br />
9. Normalize your tables.<br />
<br />
10. Use schema name before your table name. like Select id from dbo.books<strong>.</strong><br />
<br />
<br />
<strong></strong><br />
<strong><span style="color: red;">:))</span></strong><br />
<b><br /></b><br />
<b><br /></b><br />
<b><br /></b><br />
<b><br /></b><br />
<b><br /></b><br />
<b><br /></b></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com1tag:blogger.com,1999:blog-3859537001461902956.post-81973892802134242622012-07-19T09:24:00.001-07:002012-07-19T09:24:09.075-07:00Enable IIS 7.0 Compression<div dir="ltr" style="text-align: left;" trbidi="on">
<b>To enable Compression at IIS 7.0</b><br />
<br />
Enabling IIS Compression can improve performance of a web site.<br />
you can enable both<br />
A) Static Compression<br />
B) Dynamic Compression<br />
<br />
Follow these steps to enable it:-<br />
Goto run and type <b>intemgr</b> => it will open up your IIS => then select your website from left hand side pane.<br />
Now at right side you will see an option Compression just click it twice and here we go.<br />
Check Static and dynamic compression.<br />
[note: By default dynamic compression is disabled you need to enable dynamic compression from server manager in administrative panel]<br />
<br />
<span style="color: red;">:)) </span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com1tag:blogger.com,1999:blog-3859537001461902956.post-48064635672428681632012-07-19T02:34:00.000-07:002012-07-19T02:34:12.059-07:00Speeding Up Your Web Site<div dir="ltr" style="text-align: left;" trbidi="on">
To speed up website we need to take care about certain things.<br />
i am providing several points which you should take care while developing and deploying your website.<br />
<br />
<div style="color: blue;">
1. Minimize HTTP request</div>
<div style="color: blue;">
2. Use a CDN for static file.</div>
<div style="color: blue;">
3. Add an Expire Header.</div>
<div style="color: blue;">
4. Gzip or compress site text. here is the link for <a href="http://cnetcode.blogspot.in/2012/07/how-to-set-gzipdeflate-compression-in.html" target="_blank">Gzip Compression</a></div>
<div style="color: blue;">
5. Put CSS at top and script at the bottom.</div>
<div style="color: blue;">
6.minimize javascript.</div>
<div style="color: blue;">
7. Avoid duplicate Scripts.</div>
<div style="color: blue;">
8.Configure Etag.</div>
<div style="color: blue;">
9.Avoid Redirects.</div>
<div style="color: blue;">
10. Flush Buffer early</div>
<br />
Definately i will elaborate on these tips or you can Google around to find some useful info!!!<br />
<br />
<span style="color: red;">:))</span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com7tag:blogger.com,1999:blog-3859537001461902956.post-68537959404489924452012-07-19T00:19:00.002-07:002012-07-19T00:20:41.271-07:00Favicon<div dir="ltr" style="text-align: left;" trbidi="on">
<b>What is Favicon ?</b><span id="summary2337138108154211764"><span style="font-weight: bold;"></span><br /><br />when you open up a browser and visit a site you will see an icon on the tab</span><br />
<span id="summary2337138108154211764">t</span><span id="summary2337138108154211764">his is called favicon.Every time when we request a page it search for favicon.</span><br />
<span id="summary2337138108154211764">It is a best practice to use favicon in asp.net application.it also optimize performance of website a bit.<br />to use favicon just add this under <Head> tag</span><br />
<span id="summary2337138108154211764"><span style="font-weight: bold;"><link rel="shortcut icon" href="<span style="color: red;">URL or path of your icon file</span>"/></span><br />Remember to replace <span style="color: red;"><span style="font-weight: bold;"></span></span></span><span id="summary2337138108154211764"><span style="font-weight: bold;"><span style="color: red;">URL or path of your icon file</span></span></span><span id="summary2337138108154211764"><span style="color: red;"><span style="font-weight: bold;"></span></span> file with your icon file's url.</span><br />
<br />
<span id="summary2337138108154211764">Enjoy programming...:)) </span></div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com0tag:blogger.com,1999:blog-3859537001461902956.post-67305898951234604032012-07-18T21:08:00.001-07:002012-07-18T23:30:33.572-07:00Visual Studio Build error<div dir="ltr" style="text-align: left;" trbidi="on">
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.<br />
<br />
Delete cache file of your project if problem in building.<br />
<br />
<b>%LocalAppData%\Microsoft\WebsiteCache</b><br />
<br />
<b>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files</b><br />
<br />
:)</div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com1New Delhi, Delhi, India28.635308 77.2249628.4123265 76.909103 28.858289499999998 77.54081699999999tag:blogger.com,1999:blog-3859537001461902956.post-58380631887471187362012-07-18T05:56:00.002-07:002012-07-19T02:35:28.776-07:00Unlimited Connection TimeOut in Asp.net and SQL<div dir="ltr" style="text-align: left;" trbidi="on">
Sometimes when we are executing a Stored procedure from Asp.net which takes a lot of time,which leads to connection TimeOut problem.<br />
There are two ways to increase connection TimeOut.<br />
1) From Asp.net Web.config<br />
2) From Sql Server database setting.<br />
<br />
For Asp.net got to web.config connection string and set <b>Connection timeout</b> Property to 0(Zero).<br />
<br />
For Sql Server right click on Server => Properties . then a server properties page will open , from left hand side menu select Connections and set <b>Remote query timeout</b> to 0.<br />
<br />
I hope somebody will find this useful.</div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com3tag:blogger.com,1999:blog-3859537001461902956.post-62104758475313902052012-07-18T04:43:00.001-07:002012-07-19T03:33:38.051-07:00How to set gzip/deflate compression in .net.<div dir="ltr" style="text-align: left;" trbidi="on">
To enable Gzip and deflate compression in Asp.net website, you just need to place this code in global.asax.<br />
however you can also apply this setting to IIS level.<br />
<br />
void Application_PreRequestHandlerExecute(object sender, EventArgs e)<br />
{<br />
<br />
try<br />
{<br />
HttpResponse Response = HttpContext.Current.Response;<br />
String AcceptEncoding = HttpContext.Current.Request.Headers["Accept-Encoding"];<br />
<br />
<a name='more'></a><br /><br />
if (String.IsNullOrEmpty(AcceptEncoding) && AcceptEncoding.Contains("gzip") || AcceptEncoding.Contains("deflate"))<br />
{<br />
if (AcceptEncoding.Contains("deflate"))<br />
{<br />
Response.Filter = new System.IO.Compression.DeflateStream(Response.Filter, System.IO.Compression.CompressionMode.Compress);<br />
Response.AppendHeader("Content-Encoding", "deflate");<br />
}<br />
else<br />
{<br />
Response.Filter = new System.IO.Compression.GZipStream(Response.Filter, System.IO.Compression.CompressionMode.Compress);<br />
Response.AppendHeader("Content-Encoding", "gzip");<br />
}<br />
}<br />
<br />
Response.AppendHeader("Vary", "Content-Encoding");<br />
}<br />
catch (Exception)<br />
{<br />
}<br />
<br />
}</div>Anonymoushttp://www.blogger.com/profile/06360016825864411831noreply@blogger.com2