Friday, December 27, 2013

diffrence between web application and website

Web Application

1. If we create any class files / functions those will be placed anywhere in the applications folder structure and it is precomplied into one single DLL.

2. In web application we have chance of select only one programming language during creation of project either C# or VB.NET.

3. Whenever we create Web Application those will automatically create project files (.csproj or .vbproj).

4. We need to pre-compile the site before deployment.

5. If we want to deploy web application project we need to deploy only .aspx pages there is no need to deploy code behind files because the pre-compiled dll will contains these details.

6. If we make small change in one page we need to re-compile the entire sites.

WebSite

1. If we create any class files/functions those will be placed in ASP.NET folder (App_Code folder) and it's compiled into several DLLs (assemblies) at runtime.

2. In website we can create pages in multi programming languages that means we can create one page code in C# and another page code in vb.net.

3. Web Sites won’t create any .csproj/.vbproj files in project

4. No need to recompile the site before deployment.

5. We need to deploy both .aspx file and code behind file.

6. If we make any code changes those files only will upload there is no need to re-compile entire site 

Wednesday, December 25, 2013

bulk inset in sql server

Create CSV file in drive C: with name sweetest. text with the following content. The location of the file is C:\csvtest.txt
1,James,Smith,19750101
2,Meggie,Smith,19790122
3,Robert,Smith,20071101
4,Alex,Smith,20040202
bulk inset in sql server
Now run following script to load all the data from CSV to database table. If there is any error in any row it will be not inserted but other rows will be inserted.
BULK
INSERT
CSVTest
FROM 'c:\csvtest.txt'
WITH
(
FIELDTERMINATOR = ',',
ROWTERMINATOR = '\n'
)
GO
--Check the content of the table.
SELECT *
FROM CSVTest
GO
--Drop the table to clean up database.
DROP TABLE CSVTest
GO

bulk inset in sql server

Tuesday, December 24, 2013

Find Stored Procedure name based on table name in sql server

Find Stored Procedure name based on table name in SQL SERVER


There are few query copy and paste in sql editor and change the name of table :


----Option 1 SELECT DISTINCT so.name
FROM syscomments sc
INNER JOIN sysobjects so ON sc.id=so.id
WHERE sc.TEXT LIKE '%tablename%'

----Option 2
SELECT DISTINCT o.name, o.xtype
FROM syscomments c
INNER JOIN sysobjects o ON c.id=o.id
WHERE c.TEXT LIKE '%tablename%'

Tuesday, December 17, 2013

Sql Offset

SELECT *
  FROM [fortune].[dbo].[TblStates] order by StateID desc Offset
  2 Rows fetch Next 2 Rows only;

This is important when the data is large and we need few record on click .

Note : offset work only in sql server 2012 and above version on change of offset number the result will change .

Sql Offset



WITH ShowMessage(STATEMENT, LENGTH)AS
(
SELECT STATEMENT = CAST('I Am ' AS VARCHAR(300)), LEN('I Am') UNION ALL SELECT
CAST(STATEMENT + 'Sandeep! ' AS VARCHAR(300)) , LEN(STATEMENT)+ 9 FROM ShowMessage WHERE LENGTH < 300
)
SELECT STATEMENT, LENGTH FROM ShowMessage

Sql Offset

Above we are keeping the record in tempoarary table that is showmessage  and in the last query we are fetching record from temp table.

Tuesday, December 3, 2013

read excel file in sql server

Here the code to read excel file from sql server

SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=D:\sheet(3-12-2013).xls','SELECT *  FROM [Sheet1$]')

Modify database path

but it gives while excuting query to overcome the problem Excute below syntex:

sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;

and then

sp_configure 'show advanced options', 1;
RECONFIGURE;

Now the above query will work..



Monday, December 2, 2013

Comma seprated value in multiple rows sql server

Comma seprated value in multiple rows sql server


Above is my output after executing the query but i want to to separated  row means multiple row splitting the taskid column by ' , '.

After so many searches and some modification i able to create a query which is very helpful for me -


SELECT  
     Split.a.value('.', 'VARCHAR(100)') AS taskid,  A.invoiceid,A.Rate
 FROM  (SELECT 
         CAST ('<M>' + REPLACE([taskids], ',', '</M><M>') + '</M>' AS XML) AS String , [invoiceid],[Rate]
     FROM  SMOInvoiceHistory) AS A CROSS APPLY String.nodes ('/M') AS Split(a)


Comma seprated value in multiple rows sql server
Happy Coding...........

Tuesday, November 12, 2013

Application state and Global.asax file in ASP.NET

Application state:- If we want to store application specific information then we can use Application object.Information is stored in application object that will  accessible to all the user of the application.
      Application state is used to store data corresponding to all the variables of an asp.net application.The data in application state is stored once and read several times.Application state uses the HttpApplication  state class to store and share the data throughout the application .The HttpApplication state class provides a lock method,which you can use to ensure that only one user is able to access and  modify the data of an application at any time.
  The Global.asax Application File:- The Global.asax file resides in the root directory of an asp.net web application.Events and states such as session state and Application state,are specified in the Global.asax file.
     Global.asax file is used to maintain session and  application specific event within an application.We can have only one Global.asax file in a asp.net application. 
There are some steps to implement the application state and Global.asax file in ASP.NET websites ,which are shown below:-

Step 1:- First open your visual studio-->File-->New-->Website-->Select ASP.NET Empty website-->ok-->open solution Explorer--> Add a New web Form -->drag and drop Label,Text Box and Button control on the Form as shown below:-
Application state and Global.asax file in ASP.NET


Step 2:- Double click on submit button -->Write the following codes which are given below:-



















using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {   //show the application id value through application state.
        Label1.Text = Application["id"].ToString();
        //count total number of visistor visited the site.
        Label2.Text = Application["count"].ToString();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Application.RemoveAll();
        Response.Redirect("Application.aspx");
    }
}

Step 3:-  Now open solution Explorer--> Add a New web Form(default.aspx)-->drag and drop Label and Button control on the Form (default.aspx) as shown below:-
Application state and Global.asax file in ASP.NET


Step 4:-  Now open your solution Explorer -->Add Global.asax file and write the following code as shown below:-





































<%@ Application Language="C#" %>
<script runat="server">
    public static int count = 0;
    void Application_Start(object sender, EventArgs e)
    {
        Application["count"] = 0;
    }
     
    void Application_End(object sender, EventArgs e)
    {
         
        //  Code that runs on application shutdown
    }
         
    void Application_Error(object sender, EventArgs e)
    {
        // Code that runs when an unhandled error occurs
    }
    void Session_Start(object sender, EventArgs e)
    {
        if (Application["count"] != null)
        {
            int i = Convert.ToInt32(Application["count"]) + 1;
            Application["count"] = i;
            Application.UnLock();
        }
        else
        {
            Application["count"] = 1;
        }
    }
    void Session_End(object sender, EventArgs e)
    {
        // Code that runs when a session ends.
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is set to StateServer
        // or SQLServer, the event is not raised.
    }     
</script>


Step 5:- Now go Default.aspx file --> Double lick on the form (press F7) -->Write the following codes as shown below:-


















using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {   //show the application id value through application state.
        Label1.Text = Application["id"].ToString();
        //count total number of visistor visited the site.
        Label2.Text = Application["count"].ToString();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Application.RemoveAll();
        Response.Redirect("Application.aspx");
    }
}

Step 6:-Now Run the application(press F5)-->Enter the Required field as shown below:-
Application state and Global.asax file in ASP.NET
Step 7:-  Now click submit button and see the output:-
Application state and Global.asax file in ASP.NET

Note:- This application give error if you run without close it.when run the application after getting the output close the application and run again then you will see,visitor will be  increased. You can handled the error using the Global.asax file  also.
For More:-
  1. Cookie in asp.net website
  2. Validation control in asp.net
  3. web form control
  4. Reflection in c#
  5. Transaction in sql server
  6. Views in Sql server
  7. Create captcha image
For download whole Application
          Download

Source:   http://www.msdotnet.co.in/2013/10/how-to-use-application-state-and.html

Monday, November 11, 2013

QrCode in asp.net c#

Create QRCODE with the help of handler.before writting this code i tried many libraries but none of them work for me.In the last i found handler which is given below

QRCode Problem Resolved
  1. No Watermark
  2. You can give width and height. Both Will be same such as qrcode image will be 200 X 200 px when you are giving input 200.
  3. Images are automatically save in the folder.
  4. Here i m creating QRCODE Image, Pdf, Eps format.
How to Create QRCODE

  • Create Default website File --> New --> Website
  • Add To Dll
    1. Gma.QrCodeNet.Encoding.Net35.dll 
    2. itextsharp.dll
  1. Rename Default.aspx  to test.aspx
Here the test.aspx Code copy and paste it
 <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="test.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title>Untitled Page</title>

    <link href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.min.css" rel="stylesheet">

        <script type="text/javascript">

               function generate() {

                       var t = document.getElementById('t').value;

                       var e = document.getElementById('e').value;

                       //var q = document.getElementById('q').value;

                       var q = document.getElementById('size').value;

                       var s = document.getElementById('s').value;

                       var f = document.getElementById('f').value;

                       var image = document.getElementById('result');

                       //image.src = 'QrCodeHandler.ashx?e=' + e + '&q=' + q + '&s=' + s + '&f=' + f + '&t=' + encodeURI(t);

                       image.src = 'QrCodeHandler.ashx?e=' + e + '&q=' + q + '&s=' + s + '&f=' + f + '&t=' + encodeURI(t);

                       image.alt = image.title = t;

                       return false;

               }

        </script>

</head>

<body>

   <div class="container">

               <div class="page-header">

                       <h1>Native JavaScript <a href="/index.htm" class="pull-right"><i class="icon-home"></i></a></h1>

                       <p>A single JavaScript function building the URL to get the QR code image. Doesn't use jQuery or any other library.</p>

               </div>

               <div class="row">

                       <div class="span8">

                              <form class="form-horizontal" runat=server id="form1">

                                      <div class="control-group">

                                             <label class="control-label" for="t">QR code content</label>

                                             <div class="controls">

                                                     <input type="text" id="t" placeholder="QR code content" class="input-block-level">

                                             </div>

                                      </div>

                                      <div class="control-group">

                                             <label class="control-label" for="e">Error correction level</label>

                                             <div class="controls">

                                                     <select id="e">

                                                            <option value="L">Low</option>

                                                            <option value="M" selected="selected">Medium</option>

                                                            <option value="Q">Quartile</option>

                                                            <option value="H">High</option>

                                                     </select>

                                             </div>

                                      </div>

                                      <div class="control-group">

                                             <label class="control-label" for="size">QR code content size</label>

                                             <div class="controls">

                                                     <input type="text" id="size" placeholder="QR code content" class="input-block-level">

                                             </div>

                                      </div>

                                      <div class="control-group">

                                             <label class="control-label" for="f">Image Format</label>

                                             <div class="controls">

                                                     <select id="f">

                                                            <option value="Png" selected="selected">Png</option>

                                                            <option value="Gif" >Gif</option>

                                                            <option value="jpeg">Jpeg</option>

                                                     </select>

                                             </div>

                                      </div>

                                      <div class="control-group">

                                             <label class="control-label" for="s">Module size</label>

                                             <div class="controls">

                                                     <select id="s">

                                                            <option value="4">4</option>

                                                            <option value="8">8</option>

                                                            <option value="12" selected="selected">12</option>

                                                     </select>

                                             </div>

                                      </div>

                                      <div class="control-group">

                                             <div class="controls">

                                                     <a onclick="return generate()" class="btn">Generate</a>

                            <asp:Button ID="btnsave" runat="server" Text="Save" onclick="btnsave_Click" class="btn" />

                                             </div>

                                      </div>

                              </form>

                       </div>

                       <div class="span4">

                              <img id="result" runat=server/>

                       </div>

               </div>

        </div>

</body>

</html>


Test.aspx.cs
using System;

using System.Drawing.Imaging;

using System.IO;

using System.Net;

using System.Web;

using Gma.QrCodeNet.Encoding;

using Gma.QrCodeNet.Encoding.Windows.Render;

public partial class _Default : System.Web.UI.Page

{

    protected void Page_Load(object sender, EventArgs e)

    {

      

    }

    public void saveimage(string ImageLink)

    {

   

    }

    protected void btnsave_Click(object sender, EventArgs e)

    {

        Response.Write(result.Src.ToString().Trim());

    }

}


  • Create Three Folder Name them eps, images, pdf on the root .
  • Right Click On Solution Explorer -->Add New item --> Generic handler

    1.     Name handler as QrCodeHandler.ashx

    QrCodeHandler.ashx.cs Code 
  • using System;

    using System.Drawing.Imaging;

    using System.IO;

    using System.Net;

    using System.Web;

    using Gma.QrCodeNet.Encoding;

    using Gma.QrCodeNet.Encoding.Windows.Render;

    using System.Drawing;

    using iTextSharp.text.pdf;

    /// <summary>

    /// Summary description for QrCodeHandler

    /// </summary>

    public class QrCodeHandler : IHttpHandler

    {

        public void ProcessRequest(HttpContext context)

        {

            // Retrieve the parameters from the QueryString

            var codeParams = CodeDescriptor.Init(context.Request);

            // Encode the content

            if (codeParams == null || !codeParams.TryEncode())

            {

                context.Response.StatusCode = (int)HttpStatusCode.BadRequest;

                return;

            }

            //



         

            // Render the QR code as an image

            using (var ms = new MemoryStream())

            {

                codeParams.Render(ms);

                string appPath = HttpContext.Current.Request.ApplicationPath;

                string physicalPath = HttpContext.Current.Request.MapPath(appPath);

                string strpath = physicalPath + "";

                string WorkingDirectory = strpath;

              

                System.Drawing.Image imgSave = System.Drawing.Image.FromStream(ms);

                Bitmap bmSave = new Bitmap(imgSave);

                Bitmap bmTemp = new Bitmap(bmSave);

               // Graphics grSave = Graphics.FromImage(bmTemp);

               //grSave.DrawImage(imgSave, 0, 0, 12*33, 12*33);

                String pdfextension = Convert.ToString(DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString() + DateTime.Now.Day.ToString() + DateTime.Now.Hour.ToString() + DateTime.Now.Second.ToString());

                bmTemp.Save(WorkingDirectory + "\\images\\" + "abc1" + pdfextension + "."+codeParams.ImgFormat.ToString().Trim());

                // Create eps

                bmTemp.Save(WorkingDirectory + "\\eps\\" + "abc1" + pdfextension + ".eps");

                // eps close

                // Create and Save pdf

                var doc1 = new iTextSharp.text.Document();

                // path = image source

                String path = WorkingDirectory + "\\images\\" + "abc1" + pdfextension + "." + codeParams.ImgFormat.ToString().Trim();

                PdfWriter.GetInstance(doc1, new FileStream(WorkingDirectory + "/pdf/" +"abc1"+ pdfextension + ".pdf", FileMode.Create));

                doc1.Open();

                String filename = path;

                String[] getimage = filename.Split('\\');

                using (FileStream fs = new FileStream(WorkingDirectory+ "\\images\\" + getimage[4], FileMode.Open))

                {

                   iTextSharp.text.Image png = iTextSharp.text.Image.GetInstance(Image.FromStream(fs), System.Drawing.Imaging.ImageFormat.Png);

                 //  png.ScaleAbsolute(500, 300);

                   doc1.Add(png);

                }

                doc1.Close();

                // pdf close

             

                imgSave.Dispose();

                bmSave.Dispose();

                bmTemp.Dispose();

               // grSave.Dispose();

             

                context.Response.ContentType = codeParams.ContentType;

                context.Response.OutputStream.Write(ms.GetBuffer(), 0, (int)ms.Length);

            }

        }

        /// <summary>

        /// Return true to indicate that the handler is thread safe because it is stateless

        /// </summary>

        public bool IsReusable

        {

            get { return true; }

        }

    }

    /// <summary>

    /// Class containing the description of the QR code and wrapping encoding and rendering.

    /// </summary>

    internal class CodeDescriptor

    {

        public ErrorCorrectionLevel Ecl;

        public string Content;

        public QuietZoneModules QuietZones;

        public int ModuleSize;

        public BitMatrix Matrix;

        public string ContentType; 

        public string ImgFormat;

        public int ImgSize;

        /// <summary>

        /// Parse QueryString that define the QR code properties

        /// </summary>

        /// <param name="request">HttpRequest containing HTTP GET data</param>

        /// <returns>A QR code descriptor object</returns>

        public static CodeDescriptor Init(HttpRequest request)

        {

            var cp = new CodeDescriptor();

            // Error correction level

            if (!TryParse(request.QueryString["e"], out cp.Ecl))

                cp.Ecl = ErrorCorrectionLevel.M;

            // Code content to encode

            cp.Content = request.QueryString["t"];

            // Size of the quiet zone

            //if (!TryParse(request.QueryString["q"], out cp.QuietZones))

            //    cp.QuietZones = QuietZoneModules.Two;

         

            // Module size

            if (!int.TryParse(request.QueryString["s"], out cp.ModuleSize))

                cp.ModuleSize = 12;

            if (!int.TryParse(request.QueryString["q"], out cp.ImgSize))

                cp.ImgSize = 396;

            if (request.QueryString["f"].ToString().ToLower() == "png")

            {

                cp.ImgFormat = "png";

            }

            else if (request.QueryString["f"].ToString().ToLower() == "jpeg")

            {

                cp.ImgFormat = "jpeg";

            }

            else if (request.QueryString["f"].ToString().ToLower() == "gif")

            {

                cp.ImgFormat = "gif";

            }

            else

            {

                cp.ImgFormat = "png";

            }

            return cp;

        }

        /// <summary>

        /// Encode the content with desired parameters and save the generated Matrix

        /// </summary>

        /// <returns>True if the encoding succeeded, false if the content is empty or too large to fit in a QR code</returns>

        public bool TryEncode()

        {

            var encoder = new QrEncoder(Ecl);

            QrCode qr;

            if (!encoder.TryEncode(Content, out qr))

                return false;

            Matrix = qr.Matrix;

            return true;

        }

        /// <summary>

        /// Render the Matrix as a PNG image

        /// </summary>

        /// <param name="ms">MemoryStream to store the image bytes into</param>

        internal void Render(MemoryStream ms)

        {

         

           // var render = new GraphicsRenderer(new FixedModuleSize(ModuleSize, QuietZones));   

          

                //test

            var renderer = new GraphicsRenderer(new FixedCodeSize(ImgSize, QuietZoneModules.Two), Brushes.Black, Brushes.White);

             // var renderer = new GraphicsRenderer(new FixedCodeSize(400, QuietZoneModules.Zero), Brushes.Black, Brushes.White);

             // renderer.WriteToStream(qrCode.Matrix, ImageFormat.Png,/*output*/);

            // close test

                //

            if (ImgFormat == "png")

            {

               // render.WriteToStream(Matrix, ImageFormat.Png, ms);

                renderer.WriteToStream(Matrix, ImageFormat.Png, ms);

                ContentType = "image/png";

            }

            else if (ImgFormat == "gif")

            {

               // render.WriteToStream(Matrix, ImageFormat.Gif, ms);

                renderer.WriteToStream(Matrix, ImageFormat.Png, ms);

                ContentType = "image/gif";

            }

            else if (ImgFormat == "jpeg")

            {

               // render.WriteToStream(Matrix, ImageFormat.Jpeg, ms);

                renderer.WriteToStream(Matrix, ImageFormat.Png, ms);

                ContentType = "image/jpeg";

            }

        }

        public static bool TryParse<TEnum>(string value, out TEnum result)

        where TEnum : struct, IConvertible

        {

            var retValue = value == null ?

                        false :

                        Enum.IsDefined(typeof(TEnum), value);

            result = retValue ?

                        (TEnum)Enum.Parse(typeof(TEnum), value) :

                        default(TEnum);

            return retValue;

        }

    }

     

WebConfig 

<?xml version="1.0"?>

<!--

    Note: As an alternative to hand editing this file you can use the

    web admin tool to configure settings for your application. Use

    the Website->Asp.Net Configuration option in Visual Studio.

    A full list of settings and comments can be found in

    machine.config.comments usually located in

    \Windows\Microsoft.Net\Framework\v2.x\Config

-->

<configuration>

        <configSections>

               <sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

                       <sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

                              <section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

                              <sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">

                                      <section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>

                                      <section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

                                      <section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

                                      <section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>

                              </sectionGroup>

                       </sectionGroup>

               </sectionGroup>

        </configSections>

        <appSettings/>

        <connectionStrings/>

        <system.web>

               <!--

            Set compilation debug="true" to insert debugging

            symbols into the compiled page. Because this

            affects performance, set this value to true only

            during development.

        -->

               <compilation debug="true">

                       <assemblies>

                              <add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

                              <add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                              <add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

                              <add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>

                       </assemblies>

               </compilation>

               <!--

            The <authentication> section enables configuration

            of the security authentication mode used by

            ASP.NET to identify an incoming user.

        -->

               <authentication mode="Windows"/>

               <!--

            The <customErrors> section enables configuration

            of what to do if/when an unhandled error occurs

            during the execution of a request. Specifically,

            it enables developers to configure html error pages

            to be displayed in place of a error stack trace.

        <customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">

            <error statusCode="403" redirect="NoAccess.htm" />

            <error statusCode="404" redirect="FileNotFound.htm" />

        </customErrors>

        -->

               <pages>

                       <controls>

                              <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                              <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                       </controls>

               </pages>

               <httpHandlers>

                       <remove verb="*" path="*.asmx"/>

                       <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                       <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                       <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>

               </httpHandlers>

               <httpModules>

                       <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

               </httpModules>

        </system.web>

        <system.codedom>

               <compilers>

                       <compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

                              <providerOption name="CompilerVersion" value="v3.5"/>

                              <providerOption name="WarnAsError" value="false"/>

                       </compiler>

                       <compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" warningLevel="4" type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">

                              <providerOption name="CompilerVersion" value="v3.5"/>

                              <providerOption name="OptionInfer" value="true"/>

                              <providerOption name="WarnAsError" value="false"/>

                       </compiler>

               </compilers>

        </system.codedom>

        <!--

        The system.webServer section is required for running ASP.NET AJAX under Internet

        Information Services 7.0.  It is not necessary for previous version of IIS.

    -->

        <system.webServer>

               <validation validateIntegratedModeConfiguration="false"/>

               <modules>

                       <remove name="ScriptModule"/>

                       <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

               </modules>

               <handlers>

                       <remove name="WebServiceHandlerFactory-Integrated"/>

                       <remove name="ScriptHandlerFactory"/>

                       <remove name="ScriptHandlerFactoryAppServices"/>

                       <remove name="ScriptResource"/>

                       <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                       <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

                       <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

               </handlers>

        </system.webServer>

        <runtime>

               <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">

                       <dependentAssembly>

                              <assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>

                              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

                       </dependentAssembly>

                       <dependentAssembly>

                              <assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>

                              <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>

                       </dependentAssembly>

               </assemblyBinding>

        </runtime>

</configuration>


QRCode in asp.net