All About ASP.NET and ASP.NET Core 2 Hosting BLOG

Tutorial and Articles about ASP.NET and the latest ASP.NET Core

ASP.NET 4.5.1 - with :: SEO friendly URLs with ASP.NET

clock February 26, 2014 06:51 by author Kenny

Search engines like human-readable URLs with keywords in it, and hesitate to respect messy URLs with a lot of query-string parameters. So, to make our ASP.NET database-driven website SEO-friendly we have to get rid of our complex URLs.

SEO or Search Engine Optimization is the process of affecting the visibility of a website or a web page in a search engine's "natural" or un-paid ("organic") search results. In general, the earlier (or higher ranked on the search results page), and more frequently a site appears in the search results list, the more visitors it will receive from the search engine's users. SEO may target different kinds of search, including image search, local search, video search, academic search, news search and industry-specific vertical search engines.

Solution 1: Fake pages and "Server.Transfer".
As you can see the two URLs above point to the same page. Basically it is the same page and it works like this: the page mailjet-newsletter-software.aspx contains no code at all and performs a Server.Transfer (aka server-side redirect) to product.aspx like this:
That's it. We have one "product.aspx" page which expects a "ProductID" parameter and a lot of "fake pages" with SEO-friendly names like firstproduct.aspx, secondproduct.aspx etc., which simply perform a Server.Transfer to the "product.aspx" with the right ProductID.

Simple, isn't it?

But this solution requires a lot of hard-coding - we will have to create all these fake pages and add a Server.Transfer command. So let's go a little further: we will create one base class for all our "fake pages" and add a record to the "tblProducts" table in the database:

Now we have to create our fake pages, inherit them all from the ProductPage class and voi la - that's it! We can also optionally remove all the HTML-code from the aspx-files, leaving the "Page" directive only.

Solution 2: Virtual Pages.

This method is pretty similar, except that we don't need to create any pages at all. Instead, we will add an HttpModule, which intercepts HTTP requests, and the user requests a non-existent page, performs a Rewrite operation. First we will create our HttpModule:

Now we have to register our HttpModule in the web.config:

<add type="URLRewrite.ProductPageModule, URLRewrite" name="ProductPageModule" />

ASP.NET 4.5.1 - with :: How to Create Dynamic DropDownLists in ASP.NET 4.5.1

clock February 26, 2014 06:23 by author Kenny

Now i will tell you how to create Dynamic DropDownLists in ASP.NET 4.5.1


1. Create dropdownlist dynamically with autopostback property true
2. Keep dropdownlist during postback
3. Maintain selected value during postback.
Here is the sample for this.

In aspx page:
id="form1" runat="server">


        <asp:Table ID="tbl" runat="server">


        <asp:Button ID="btnSet" runat="server" Text="Button" onclick="btnSet_Click" /> </div>


To Create Dynamic Dropdownlist:

void Page_Load(object sender, EventArgs e)


    if (!Page.IsPostBack)





    private void CreateDynamicTable()


        // Fetch the number of Rows and Columns for the table

        // using the properties

        int tblRows = 3;

        int tblCols = 3;

        // Now iterate through the table and add your controls

        for (int i = 0; i < tblRows; i++)


            TableRow tr = new TableRow();

            for (int j = 0; j < tblCols; j++)


                TableCell tc = new TableCell();

                DropDownList ddl = new DropDownList();

                ddl.ID = "ddl-" + i.ToString() + "-" + j.ToString();

                for (int k = 0; k < 5; k++)


                    ddl.Items.Add(new ListItem("item-"+k.ToString(),k.ToString())); 


                ddl.AutoPostBack = true;

                ddl.SelectedIndexChanged += new EventHandler(ddl_SelectedIndexChanged);

                // Add the control to the TableCell


                // Add the TableCell to the TableRow



            // Add the TableRow to the Table


            tbl.EnableViewState = true;

            ViewState["tbl"] = true;



protected void ddl_SelectedIndexChanged(object sender, EventArgs e)


    // what you want to perform    


To retrieve value on button click:

void btnSet_Click(object sender, EventArgs e)


        foreach (TableRow tr in tbl.Controls )


            foreach (TableCell tc in tr.Controls)


                if (tc.Controls[0] is DropDownList)


                    Response.Write(((DropDownList)tc.Controls[0]).SelectedItem.Text+" ");        





Right Now, No output because dynamic controls are lost in postback then what to do.

So we need to save dynamic controls value and generate dynamic controls again.we need to maintain viewstate.

override object SaveViewState()


    object[] newViewState = new object[2];

    List<string> txtValues = new List<string>();

    foreach (TableRow row in tbl.Controls)


        foreach (TableCell cell in row.Controls)


            if (cell.Controls[0] is DropDownList)






    newViewState[0] = txtValues.ToArray();

    newViewState[1] = base.SaveViewState();

    return newViewState;


protected override void LoadViewState(object savedState)


    //if we can identify the custom view state as defined in the override for SaveViewState

    if (savedState is object[] && ((object[])savedState).Length == 2 && ((object[])savedState)[0] is string[])


        object[] newViewState = (object[])savedState;

        string[] txtValues = (string[])(newViewState[0]);

        if (txtValues.Length > 0)


            //re-load tables


            int i = 0;

            foreach (TableRow row in tbl.Controls)


                foreach (TableCell cell in row.Controls)


                    if (cell.Controls[0] is DropDownList && i < txtValues.Length)


                        ((DropDownList)cell.Controls[0]).SelectedIndex = Convert.ToInt32(txtValues[i++]);





        //load the ViewState normally








ASP.NET 4.5.1- with :: How to Create Barcodes using ASP.NET App

clock February 26, 2014 05:09 by author Kenny

To create barcodes we will use ASP.NET web services. Not only that, we will also create Windows Forms and Console application to request barcode image.

What is The Benefits?

Well, web services provide a major benefit in integrating the software with external applications. With standardized request/response model, any client application that can utilize XML web service can benefit from it.Below is the brief visual representation of the barcode service. The clients do not need to refer to Aspose.BarCode for .NET. They will just send 2 string values (codetext and symbology) and will get the barcode image (byte array) from service.

Barcode Web Service
Now, open Microsoft Visual Studio. Create a new project of type “ASP.NET Web Service Application”. Name the project as “BarCodeService”. Add reference to the following .NET assemblies.

  1. System.Drawing from .NET tab of “Add Reference” dialog box
  2. Aspose.BarCode.

Browse to the location where Aspose.BarCode for .NET is installed and select. Visual Studio adds a default class “Service1” to the Web Service project in Service1.asmx file.
Open it and add the following method to this class.

The web method needs the following two parameters from client:

  1. Codetext
  2. Symbology

These parameters are of String type. The parameters are passed to the BarCodeBuilder class, which then creates the barcode and sends the barcode image in the form of byte array to the client.
This web method can be called by any kind of application that can consume a web service.

Consume Web Service from Windows Forms Application

Open Visual Studio and create a new project of type “Windows Application”. Name the project as “ GetBarCodeWinForms ”. Add reference to the web service by right clicking on “References” and then choosing “Add Service Reference” from the context menu. Type the address of web service or discover it. After getting the correct service, give “BarCodeService” in the Namespace and click on “Ok” button to add the reference.

Design the forms as follows.

It contains the following controls:

  1. Textbox: Input codetext from user
  2. Combobox: Input symbology type from user
  3. Button: Call web service
  4. Picturebox: Display the barcode image

Write the following code on click event of the button.

Run the application, specify some values and click on the “Get Barcode” button. The application will consume the barcode web service and get the barcode image from it. The image will then be displayed on the form as below.

Consume Web Service from a Console Application

Create a new project in Visual Studio and choose “Console Application” in project type. Name the project as “ GetBarCodeConsole ”. Add the reference to the barcode service, just as we gave above in the winforms application.Write the below code in the main() method.

Run the application, it will consume the barcode web service, get barcode image and save the image locally to disk.


Aspose.BarCode for .NET can easily be used in ASP.NET web services to generate the barcodes and serve the barcode image to various clients.

ASP.NET 4.5.1 with :: An Overview on the Advance ASP.NET 4.5.1 Technology

clock February 24, 2014 10:34 by author Kenny

What's the new from ASP.NET?  Noting that the 32-bit edit & continue was released in 2005,  that the 64-bit equivalent is part of ASP.NET 4.5.1.  The functionality is exactly the same as in the 32-bit version.Next, but it has the new ability to inspect method return values.  This can be done in the Visual Studio’s “Autos” window or in the immediate window.


The return value can be expanded in the debugger so that the current value can be viewed.  The debugging of asynchronous code is made easier with improvements to the usability of the Call Stack and Tasks Window for apps targeting the Windows Store, Web Apps, and Windows 8.1 Desktop Apps.That isn’t the only improvement for Windows Store apps, as now developers can convert Convert System.IO.Stream to IRandomAccessStream.  Enhancements have also been made to WinRT’s type system (through introduction of nullable value types)  and better exception support (example: System.Exception.Message, System.Exception.StackTrace).  

These new System.Exception properties improve over the Windows 8 experience since previously an attached debugger was necessary to avoid losing information. Whereas previously a broken network connection would lead to exceptions, the new 4.5.1 experience will handle the failure gracefully.  Should the network connection become repaired, the application will identify this and continue working.ASP.NET applications can now be suspended transparently.  The actual ASP.NET worker process is suspended in a ready to go state, with a 90% reduction in startup time.  Once the application has been idle for awhile, it is paged to disk, and then retrieved when a request for the app comes in and/or is made. This functionality can be enabled via IIS Settings by changing Idle Time-out Action to “Suspend”.Under the hood, in .NET 4.5.1, you can now compact the Large Object Heap (LOH) to address heap fragmentation.  

The LOH mode is part of GCSettings, but Heydarian cautions that “with great power comes great responsibility” and that this should never have be used in ordinary development.Improvements have been made to multicore Just-In-Time (JIT) performance, Heydarian stating a 15% performance improvement for cold startups.Another area improved in .NET 4.5.1 is around the behavior of the system after the framework has been updated.  Today servicing the .NET Framework can lead to degradation in app performance directly afterwards.  This is due to core .NET assemblies being JIT-compiled for a period of time after being updated/patched.  In Windows 8.1 app performance remains consistent even after servicing the .NET Framework.  This results in a much better user experience and supports Microsoft’s efforts to provide better battery life on tablets wherever possible.One of the goals Heydarian stated his team has is to do all of the heavy lifting so that the .NET developers all benefit.  Second, he whenever possible he wants the platform’s improvements to benefit developers with minimal (if any) recoding—just better performance.

ASP.Net Hosting – :: How to Use NumericUpDownExtender in ASP.Net AJAX

clock February 24, 2014 05:09 by author Diego

NumericUpDown is an ASP.NET AJAX extender that can be attached to an ASP.NET TextBox control to add "up" and "down" buttons that increment and decrement the value in the TextBox. The increment and decrement can be simple +1/-1 arithmetic, they can cycle through a provided list of values (like the months of the year), or they can call a Web Service to determine the next value. Page authors can also provide custom images to be used instead of the default up/down button graphics. In this article, I will show you step by step procedure, how to use a Up Down Extender

In ASP.NET using Visual Studio 2005 or Visual Studio 2008.

Step 1 : Open Visual Studio.

  • Go to File->New->WebSite
  • Select ASP.NET WebSite

Step 2 :

Under Visual Studio Installed Template-> Choose ASP.NET WEB SITE -> Choose File System from the location combo box -> Set the path by the browse button - > Choose the language from the Language ComboBox (Visual C# , Visual Basic , J #)

  • Choose Visual C#

Step 3 :

Click on the OK Button.
This is the source code window :

Step 4 :
See here is a tab named Design in the bottom of this page. Click on this tab and you will see a blank web page where you can drag any control from the toolbox (which is in the left side of this window).

Step 5 :
Now drag some controls under the AJAX Extensions. First control you are going to drag and drop on the page is - Script Manager.

  • first add a tag on the top of your source code window:
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
  • Under the form tag,NumericUpDownExtender control

Step 6:

Now run the application by pressing ctrl +  F5.

Step 7 :

When you run the Up Down Extender will seem like this...


ASP.Net Hosting – :: Adding Email Confirmation to ASP.NET Identity in MVC 5

clock February 19, 2014 09:14 by author Diego

One of the mainline features about ASP.NET Identity is to make it easy to Adding Email Confirmation. This process will send an email to the user with a link they can click on to confirm their registration and log in to the system. Prior to confirmation they will not be able to log in.


This post shows how you can adding email confirmation to ASP.NET Identity in MVC 5.

First I started by creating a new MVC 5 application.  You no longer select whether you want an Internet or Intranet application, you just select the MVC template and select the authentication type you want to use. For an Internet type application you select Individual User Accounts.  Once your web application is created open IdentityModels.cs in the Models directory.  You will see a class called ApplicationUser which is analogues to the UserProfile in SimpleMembership.  It is an empty class that inherits from IdentityUser which has these properties.

You must to modify the user information to store a the confirmation token and a flag indicating whether confirmation was completed or not.

Now let’s implement the method in the AccountMembershipService class:


Here, we’re setting the confirmationGuid to user. This is the GUID stored in the database that uniquely identifies the user. We then set the verifyUrl to the Verify action on the Account controller – passing the confirmationGuid as the ID parameter. The redirect to the RegisterStepTwo action just displays a view to the user that tells them to look for the email to complete the registration process.

Once the user gets the email they click on the link that will take us back to the controller action RegisterConfirmation. With that configured, when the user clicks the register button, they’ll be sent an email with the confirmation link it, and they’ll be redirected to the confirmation page. If we find a user we set IsConfirmed to true and return true from the method; otherwise we return false. If the user is confirmed they will be able to log in.

That is all there is to setting up email confirmation using ASP.NET Identity in MVC 5.


ASP.NET 4.5.1 Hosting with :: Configuring BotDetect ASP.NET CAPTCHA Options

clock February 18, 2014 06:08 by author Ben

1. BotDetect CAPTCHA ASP.NET Configuration

BotDetect Captcha properties can be set in several different ways, depending on the type of value you are customizing.

2. BotDetect CAPTCHA Web.Config Configuration Section

BotDetect configuration options which apply to all Captcha instances within a particular ASP.NET application can be specified in the web.config file. This approach can be seen in the Captcha customization code sample coming with the BotDetect installation.

This configuration section first needs to be registered at the top of the web.config file:



    <!-- Register the BotDetect configuration section -->

    <section name="botDetect" requirePermission="false"


        BotDetect" />




You can then create the <botDetect> section just below the closing </configSections> element, and (for example) disable all audio Captcha sounds in the application by specifying:


  <captchaSound enabled="false" />


3. BotDetect CAPTCHA .aspx / Visual Studio Designer Instance Settings

When adding the BotDetect:Captcha control to the .aspx file defining your form (either by using the Visual Studio Designer or editing the source directly), you can specify various attributes in the element declaration. For example, the simplest way to specify Captcha image size is:

<BotDetect:Captcha ID="SampleCaptcha" runat="server" ImageSize="200, 50" />

However, it's not recommended to use this method to set all Captcha instance properties. Page source declarations are processed when the page is loaded, and since they have to be applied to Captcha images and sounds (which come as separate Http requests), they have to be saved in ASP.NET Session state. It's better not to take up Session space if it's not necessary.

4. BotDetect CAPTCHA Code-Behind Instance Settings

It's also possible to specify various Captcha object settings in your page code-behind code. For example, code type and length can be set in the Page_PreRender override:

protected void Page_PreRender(object sender, EventArgs e)


  // initial page setup

  if (!IsPostBack)


    // Captcha code properties

    SampleCaptcha.CodeLength = 4;

    SampleCaptcha.CodeType = BotDetect.CodeType.Numeric;


The same caveat applies to this method as with .aspx settings: this code is executed when the form is loaded, but since Captcha images and sounds are loaded in separate Http requests (which don't result in this code being executed), all values set this way have to be saved in ASP.NET Session state. Since different visitors will use separate Sessions, the amount of state used is multiplied by the number of active visitors / Sessions, and it's better not to use a lot of it.

5. BotDetect CAPTCHA Event Handler Property Setting and Randomization

This is the recommended approach to Captcha instance property setting. It's the most complex method, since it requires setting up an event handler. But since this handler is going to be executed for all Captcha requests (including separate Captcha image and sound Http requests), there is no need to persist the values in ASP.NET Session state.

Randomizing Captcha properties significantly improves Captcha security, and it should always be performed in this event handler instead of Page_Load or Page_PreRender, because the Captcha control event is also fired for direct Captcha image and sound requests (which skip the page events since the page is never loaded) – for example when clicking the Captcha reload button repeatedly.

You can see this approach to BotDetect Captcha property setting implemented in the Captcha randomization code sample coming with the BotDetect installation.

First, a InitializedCaptchaControl event handler needs to be registered in the Page_Init override:

protected void Page_Init(object sender, EventArgs e)


  SampleCaptcha.InitializedCaptchaControl +=

    new EventHandler<InitializedCaptchaControlEventArgs>(



Then, randomization rules can be declared in the event handler:

void SampleCaptcha_InitializedCaptchaControl(object sender,

  InitializedCaptchaControlEventArgs e)


  if (e.CaptchaId != SampleCaptcha.CaptchaId)




  CaptchaControl captcha = sender as CaptchaControl;

  // randomize code generation properties

  captcha.CodeStyle = CaptchaRandomization.GetRandomCodeStyle();

  captcha.CodeLength = CaptchaRandomization.GetRandomCodeLength(4, 5);

  captcha.ImageStyle = CaptchaRandomization.GetRandomImageStyle();

  captcha.SoundStyle = CaptchaRandomization.GetRandomSoundStyle();


The CaptchaRandomization helper allows easy randomization of Captcha parameters. Proudly Launches IIS 8.5 Hosting

clock February 10, 2014 09:54 by author Ben proudly launches the support of IIS 8.5 on all their newest Windows Server 2012 R2 environment. IIS 8.5 Hosting plan starts from just as low as $1.00/month only.,a leading web hosting provider and ASP.NET specialist, today launched the latest update of the Microsoft IIS technology. The IIS 8.5,  introduces many new features including several that focus on premium media experiences and business application development for faster loading websites, business services and applications regardless of an organisations requirements.

IIS 8.5 will be released with the Windows Server 2012 R2 product. With IIS 8.5, the IIS team continued its focus on scalability and manageability improvements.  IIS 8.5 adds sophisticated features like Dynamic Website Activation, Enhanced Logging and Logging to Event Tracing for Windows in IIS .8.5.

Another wonderful feature of IIS 8.5  is Suspended AppPools. This new feature allows applications hosted on IIS 8.5 to be suspended instead of being terminated, so when the site is shutdown because of the idle timeout, instead of completely killing the worker process, all the state is saved into disk.

“Our customers have been asking us about IIS 8.5 and we are happy to deliver a hosting platform that supports all the latest in the Microsoft Web Stack. With the launched of IIS 8.5 hosting services, we hope that developers and our existing clients can try this new features.” said Dean Thomas, Manager at

Where to look for the best IIS 8.5 hosting service? How to know more about the different types of hosting services? Read more about it on

As a leading hosting provider, offers a comprehensive range of services including domain name registrations, servers, online backup solutions and dedicated web hosting. is well placed to deliver a high quality service.

About is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and sharepoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.


Cheap ASP.NET 4.5 Hosting

We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

Author Link

 photo ahp banner aspnet-01_zps87l92lcl.png


Corporate Address (Location)

170 W 56th Street, Suite 121
New York, NY 10019
United States

Tag cloud

Sign in