Showing posts with label ASp.net. Show all posts
Showing posts with label ASp.net. Show all posts

Sunday, July 29, 2012

Send multiple parameters in jquery ajax in asp.net


Here I am going explain how to send  multiple parameters using JQuery or JSON in asp.net.
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.
Let's write a simple code to understand it.

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.

Sunday, July 22, 2012

Send Asynchronous Email in Asp.net

Send Asynchronous Email in Asp.net?

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.

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("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) 
            smtp.SendAsync( cnetcode_mail, userState );
        }

Thursday, July 19, 2012

Favicon

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 asp.net application.it 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.

%LocalAppData%\Microsoft\WebsiteCache

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

:)

Unlimited Connection TimeOut in Asp.net and SQL

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

For Asp.net 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.