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 Hosting - ASPHostPortal :: How to Fix Error - The Controls collection cannot be modified because the control contains code blocks

clock July 22, 2011 06:01 by author Jervis

Server Error in '/' Application



The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.


Exception Details:
System.Web.HttpException: The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

Source Error:


Line 132:                        metaKey.Name = "keywords";
Line 133:                        metaKey.Content = p.MetaKeywords;
Line 134:                        this.Page.Header.Controls.Add(metaKey);
Line 135:                    }
Line 136:                    if (!String.IsNullOrEmpty(p.MetaDescription))


Source File:
a:\xyz\ContentHandler.aspx.cs    Line: 134

Stack Trace:


[HttpException (0x80004005): The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).]
   System.Web.UI.ControlCollection.Add(Control child) +2105903
   ContentHandler.Page_Load(Object sender, EventArgs e) in a:\xyz\ContentHandler.aspx.cs:134
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1061


Version Information:
 Microsoft .NET Framework Version:2.0.50727.832; ASP.NET Version:2.0.50727.832

How to Fix it?

It is really simple, just remove the inline code blocks and JavaScript and move it to your code behind i.e

string _manageSearch = String.Format( @" 
        function ManageSearch(){{
                var lbl = document.getElementById(""lblFindAGift"");
                var txt = document.getElementById(""{0}"");
                var btn = document.getElementById(""{1}"");

                .Do Something with it..

        }}",

        txtSearch.ClientID);

this.Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "ManageSearch", _manageSearch, true);


Simple, right? Good luck. Hope it helps!!

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: ASP.NET 4.0 Session State

clock July 21, 2011 06:58 by author Jervis

This post explains about Shrinking session state in ASP.NET 4.0

ASP.NET Provides two options for storing session state for web applications.

1. Out of process session state
2. MS SQL server session state

In both the options session-state providers stores the data out side the web application   worker process. Session state has to be serialized before it sends it to the external storage.

ASP.NET 4.0 introduces a new compression option for both out-of-process session state providers. We can set the compressionEnabled option in configuration file to true. ASP.NET will compress the session state by using the .NET Framework System.IO.Compression.GZipStream class.

We can configure the session state as follows

<sessionState
    mode="SqlServer"
    sqlConnectionString="data source=dbserver;Initial Catalog=aspnetstate"
    allowCustomSqlDatabase="true"
    compressionEnabled="true"
/>

Advantage: With this addition of attribute to web.config file there is substantial reduction in the size of serialized session-state data.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: How To Style a GridView with CSS in ASP.NET 4.0

clock July 19, 2011 08:28 by author Jervis

Adding the Database

To demonstrate how to apply styles to a gridview we will need to create a simple web site with a database to populate the gridview with data. Then, we will need to add in some CSS to style it. To begin, create a new ASP.NET Empty Web Site. Then, to add the database:

1. Right click the project in your solution explorer.
2. Select add ASP.NET folder.
3. Select App_Data.
4. Right click the App_Data folder in your solution explorer.
5. Select add new item…
6. Select a Sql Server Database.
7. Click add.

Now that we have a database, we need to add a table to it with some sample data. To do this:

1. Expand the Database.mdf folder in your server/database explorer.
2. Right click the Tables folder.
3. Select add new table.
4. Add the following columns with their respective types to the table:

Column Name

Data Type 

 ID

 int 

 Data

 nvarchar(50)


5. Save the table as ‘Table1’

Next, add the following sample data to Table1:

ID 

Data 

 1

 Temp data 1 

 2

 Temp data 2

 3

 Temp data 3

 4

 Temp data 4


Adding the Default.aspx Page

Next, we need to add a web form with a gridview on it. To do this:


1. Right click the project in your solution explorer.
2. Select add new item…
3. Select a web form.
4. Name it ‘Default.aspx’.
5. Click add.
6. Open Default.aspx up to design mode.
7. Drag and drop a gridview control onto the web form.
8. Expand the GridView Tasks menu.
9. From the Choose Data Source dropdownlist select <New data source…>.
10. Select a SQL Database and click OK.
11. Use the dropdown list to select Database.mdf and click Next.
12. Choose to save the connection string and click Next.
13. Click Next leaving the default select statement.
14. Finally, you can test your query and ensure that it is correct and click Finish.

Adding the CSS StyleSheet


Next, we need to add a new CSS style sheet to the project to which we will add our CSS classes. To do this:

1. Right click the project in your solution explorer.
2. Select add new item…
3. Select a style sheet.
4. Name it ‘StyleSheet.css’.
5. Click add.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: Implementing Paging Functionality in ASP-GridView

clock July 15, 2011 07:13 by author Jervis

When you bind a GridView to any of the Data Sources (i.e. asp:SqlDataSource, asp:AccessDataSource or asp:ObjectDataSource ) and set its AllowPaging property to "true", the underlying paging functionality for the GridView is automatically handled. There are situations when you prefer to bind Grid with a simple DataTable instead of a DataSource. In that case paging events should be handled manually.

First of all drag an asp:GridView control to the web form and set its AllowPaging property to "true". In order to implement paging functionality in GridView, the ‘onpageindexchanging’ event should be handled. Double click on onpageindexchanging event of GridView to insert its even handler. Below is the aspx GridView source

<asp:GridView ID="GridView1" runat="server"
AllowPaging="True" 
onpageindexchanging="gridView1_PageIndexChanging">
<Columns>
</Columns>
</asp:GridView>

Now populate a DataTable (to be bound with GridView) with the desired data. Then write a DataBindGrid function that is used to bind GridView to this DataTable. Below is code:

private void DataBindGrid()
{
    DataTable dt = GetDataTable("sql string");
    this.GridView1.DataSource = dt;
    this.GridView1.DataBind();
}

Reason behind is you have to call this function twice (i.e. in page load event and in gidview1_PageIndexChanging event).

Below is the code

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
        DataBindGrid();
}
protected void gridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
    GridView1.PageIndex = e.NewPageIndex;
    DataBindGrid();
}

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: How to Change ASP.NET Temporary Files Folder

clock July 11, 2011 07:46 by author Jervis

One of my client was having problems with the small space on the C drive on a server machine which was hosting a ASP.net application. There were few errors in the server error about “No enough space”.Though I would say that in ideal situation it would be best to increase the space on the C: drive as most of the other Operating System related applications also reply on the free space on C: drive, when there is no other easy way of increasing the space on C: drive, administrator can relocate the temporary files folder created by ASP.net.

Please note that ASP.net create a compile version of the site and stores it in its default temporary ASP.net folder. This is usually %Windows Install Folder%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files (For ASP.Net 2.0). This folder can grow very fast in case web server has large ASP.net sites hosted on that server. Fortunately, ASP.net provides a simple way to change this location. This is stored in the web.config file and can defined in the Global web.config (placed at %Windows Install Folder%Microsoft.NET\Framework\v2.0.50727\CONFIG). To change this path add the new full folder path in the Compilation section of the configuration file. Here is a sample of how this looks like (this must be under System.Web section):

<compilation tempDirectory=“E:\ASP.Net Temporary Folder\” debug=“false“>


One can find the documentation of all different sections of ASP.net configuration file at:
http://msdn2.microsoft.com/en-us/library/b5ysx397(VS.71).aspx

In case when Internet is not available, or you just need a quick reference, there is also a small helpful file in the configuration folder. This file is named “web.config.comments” and is in the CONFIG folder of the ASP.net framework folder.

Please try it and good luck!!

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: Using JQuery With MasterPages in ASP.NET 4.0

clock July 8, 2011 07:34 by author Jervis

In this tutorial we will learn how to use JQuery with master pages in ASP.NET 4.0. Typically when you are working with an ASP.NET page, referencing external JavaScript libraries is easy. However, things get a little tricky when you begin working with master pages. Master pages do some weird things behind the scenes, that you will need to understand in order to be able to use JQuery on your pages effectively.

To begin, create a new ASP.NET Empty Web Site in Visual Studio. First, we will need to add a reference to JQuery. If you don’t have JQuery you can download it at
http://jquery.com/. Once you have it, you are ready to add it to your project. To do this:

1. Right click the project in your solution explorer.
2. Select ‘Add Existing Item…’.
3. Navigate to your JQuery file and select it.
4. Click add.

Now that we have the library local to our project, we will create a new master page to reference this from. To add a new master page:

1. Right click the project in your solution explorer.
2. Select ‘Add New Item…’.
3. Select a master page and name it ‘MasterPage.master’.
4. Click add.

Typically, when a reference or script is added to an ASP.NET page it is added in the head section. We will be adding our JQuery reference here, however we must be careful about our positioning. The master page also generated two ContentPlaceHolder sections. One in the head section appropriately named ‘head’, and the other in the body section named ‘ContentPlaceHolder1′. When we write scripts on our other web pages that will be using JQuery, we must ensure that the JQuery reference comes before the script using it. In this case, we will want to drag and drop the JQuery file into our head section, right about the ‘head’ content place holder. My new head section looks like the following:

<head runat="server">
    <title></title>
    <!-- We add all of our external references for our pages here -->
    <script src="jquery-1.6.js" type="text/javascript"></script>

    <asp:ContentPlaceHolder id="head" runat="server">
    </asp:ContentPlaceHolder>
</head>

Next, we need to add a new ASP.NET page to our project using our master page. To do this:

1. Right click the project in your solution explorer.
2. Select ‘Add New Item…’.
3. Select a new ASP.NET page and name it ‘Default.aspx’.
4. Click the ‘Select master page’ check box.
5. Click add.
6. Select ‘MasterPage.master’ and click OK.

Cool, we now have a new page using our master page. This page contains two Content sections that correspond to the ContentPlaceHolder sections of our master page. In this case, we will add some test code to our ‘head’ content section which will use some JQuery. It is important to note that this will work here only because we have configured our master page to have a reference to JQuery before our scripts on this page are read.

To this page, go ahead and add a new button with a Text property of ‘Click Me’, and an OnClientClick property of ‘ButtonClick()’. Next, add the following code to the ‘head’ content section:

<script type="text/javascript">
    function ButtonClick() {
        alert($('#ContentPlaceHolder1_Button1').val());
    }
</script>

This is a simple script that will grab our button by its ID and display the value it holds. It is important to note that Microsoft’s naming standards come into play here when you place controls inside of content place holders. If you were to look at the generated HTML of the page, you would notice that our ‘Button1′ control has an ID of ‘ContentPlaceHolder1_Button1′. This is because the content place holder it is in is added to the beginning of the control, separated by an underscore.

To test this out, load up the web site and click the button. You should see an alert box that displays the message ‘Click Me’ which corresponds to the text in our button. This demonstrates how to set up your master pages to work easily with JQuery. I hope that this helps, happy coding!

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: How to Post Message from Your ASP.NET Site to Twitter

clock July 7, 2011 05:40 by author Jervis

Practical Example for Twitter Programming in .Net

1.
Download Twitterizer API for Twitter Programming in .Net

2. Create New Asp.net Website. 

3. Arrange the Web Controls as shown in Figure.

4. Add Twitterizer Reference.

Right Click Website in Solution Explorer, and select "Add Reference" from Popup dialog.

Add the Twitterizer.Framework.dll which you have downloaded in Step1.

5. Write the code

Add Namespace: using Twitterizer.Framework;

Add following code on Shout button click event.
protected void btnShout_Click(object sender, EventArgs e)
{  
string TwitterUserName = "twitasp";
string TwitterPassword = "mypassword";
string TwitterMessage = txtShout.Text;

if (TwitterUserName != string.Empty && TwitterPassword != string.Empty)
{
try
{

Twitter twitter = new Twitter(TwitterUserName,TwitterPassword);

string TwitterMsg = txtShout.Text;
if (txtShout.Text.Length > 120)
{
TwitterMsg = TwitterMsg.Substring(0, 130) + "... For more update logon to
DailyFreeCode.com"
;

}
else
{
TwitterMsg = TwitterMsg + "... For more update logon to DailyFreeCode.com";
}
twitter.Status.Update(TwitterMsg);
lblTwitMsg.Text = "Your have shout successfully on http://twitter.com/" + TwitterUserName;

}
catch (Exception ex)
{
Response.Write("<b>" + ex.Message + "</b><br>" + ex.StackTrace);
}
}
}

Lets Post one Message from Asp.net Website Developed.

Type your Message in Textbox and Press Shout button, you can then check your Twitter website to check whether update is applied or not.

Now Press “Shout on Twitter!” button

Now check the Twitter Website for Profile we have Shout on. http://twitter.com/twitasp



Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: Using HttpHandlers and HttpModules in your ASP.NET Websites

clock June 29, 2011 07:30 by author Jervis

Introduction

In this article I would explain about HttpModules and HttpHandlers and how to use it on your Website.
Sometimes, just creating dynamic Web pages with the latest languages and
databases just does not give you , the developer enough control over an application. At times, you need to be able to dig deeper and create applications that can interact with the Web Server itself. You want to be able to interact with the low level processes such as how the Web Server processes incoming and outgoing HTTP requests.

Before ASP.NET, in order to get this level of control using IIS, you were forced to create ISAPI extensions or filters. This proved to be quite daunting and painful task for many developers because creating ISAPI extensions and filters required knowledge of C/C++ and knowledge of how to create native Win32 DLLs. Thankfully, in .NET world, creating these types of low level applications is really no more difficult than most other tasks you would normally perform.


HttpModules

HttpModules are simple classes that can plug themselves into the request processing pipeline. They do this by hooking into a handful events thrown by the application as it processses the HTTP request. To create an HttpModule, you simply create a class that derives from the System.Web.IHttpModule interface. This interface requires you to implement two methods: Init and Dispose. The code snippet below will show you how to implement the methods.

Code in VB.NET

    Imports Microsoft.VisualBasic

   Imports System.Web



   Public Class SimpleHttpModule Implements IHttpModule


       Public Overridable Sub Init(ByVal context as HttpApplication) _

              Implements IHttpModule.Init

       End Sub


       Public Overridable Sub Dispose() Implements IHttpModule.Dispose

       End Sub

   End Class


Code in C#

    using System;

   using System.Web;



   public class SimpleHttpModule :IHttpModule {

       public void Dispose() {

       }     



       public void Init(HttpApplication context) {

       }

   }


The Init Method is the primary method that you use to implement the functionality. Notice that it has single method parameter named HttpApplication object named context. The parameter gives you access to the current HttpApplication context and it is what you use to wire up the different events that fired during the request processing.

Below is the list of the important EventName that you can use with the HttpApplication object.
1. AcquireRequestState.
Raised when ASP.NET runtime is ready to acquire the SessionState of the current Http request

2. AuthenticateRequest.
Raised when ASP.NET runtime is ready to authenticate the identity of the user.

3. AuthorizeRequest
Raised when ASP.NET runtime is ready to authorize the user for the resources user is trying to
access.

4. BeginRequest
Raised when ASP.NET runtime receivess a new HTTP request.

5. End Request
Raised just before sending the response content to the client


Simple Example using HTTPModule


The example below will showsyou how to modified the HTTP output stream before it get sent to the client. This can be a simple and useful tool if you want to add text to each page served from your Website but do not want to modify each page.

Code in VB.NET


    Public Class SimpleHTTPModule Implements IHttpModule

       Dim WithEvents oApps as HttpApplication = Nothing



       Public Overridable Sub Init(ByVal context as HttpApplication) _

           Implements IHttpModule.Init

           oApps = context

       End Sub  



       Public Overridable Sub Dispose() Implements IHttpModule.Dispos

       End Sub     



       Public Sub_context_PreSendRequestContent(ByVal sender As Object,_

                  ByVal e as EventArgs) Handles oApps.PreSendRequestContent

            Dim message as String = ""


            oApps.Context.Response.Output.Write(message);

       End Sub


   End Class


Code in C#

     public class SimpleHTTPModule : IHttpModule

    {

         private HttpApplication oApps = null;


         public void Dispose() {


         }


         public void Init(System.Web.HttpApplication context) {

             oApps = context;

             context.PreSendRequestContent += new EventHandler

             (context_PreSendRequestContent);

         }


         void context_PreSendRequestContent(object sender,EventArgs e) {

              string message = "<!-- This page is being processed at " +

              System.DateTime.Now.ToString() + " -->"


              oApps.Context.Response.Output.Write(message);

         }

    }


You can see from the code snippet above, we are using PreSendRequestContent event. This event fires right before the content is sent to the client and you have the last opportunity to modify it.

In the PreSendRequestContent handler method, you simply create a string containing an HTML comment that contains the current time. You take this string and write it to the current HTTP requests output stream. The Http request is then sent back to the client.

In order to use this module, you must let ASP.NET know that you want to include this module in the request pipeline. You can add the httpmodule section by modifying your web.config file.


     <system.web>

        <httpModules>

            <add name="SimpleHTTPModule" type="SimpleHTTPModule,App_code"/>

        </httpModules>

    </system.web>


The generic format of the httpModules in your web.config file is

     <system.web>

        <httpModules>

            <add name="modulename" type="namespace.classname,assemblyname"/>

        </httpModules>

    </system.web>


If you have created your HttpModule in the App_code directory of an ASP.NET project, you might wonder how you know the assemblyname value should be,considering ASP.NET 2.0 now dynamically compiles your code at runtime. The solution is to use the text App_code as the assembly name. This tells ASP.NET that your module is located in the dynamically located assembly.

You can also create HttpModules as a separate class library project in which case you simply use the assembly name of the library.

After you have added this section on your web.config file, try to run any file of your web project and view source the generated aspx file. You should be able to see the commented date time as we previously
coded in the http modules.

HttpHandlers

HttpHandlers differ from HttpModules not only because of their
positions in the request processing pipeline, but also because they must be mapped to a specific file extensions. HttpHandlers are the last stop for the incoming Http requests and are ultimately the point in the request processing pipeline that is responsible for serving up the requested content, be it in ASPX page,HTML,plain text or an image. Additionally HttpHandlers can offer significant performance gains.

In this arcticle, I will demonstrate two different ways to create a simple HttpHanlder that you can use to serve up dynamic images. First you look at creating an HttpHanlder using an ASHX file extension. Then you learn how you get even more control by mapping your HttpHandler to a custom file extension using IIS.

Generic Handlers
In Visual Studio 2005, Microsoft has introduced new template specifically for HttpHandler and it ends with .ashx extension. The .ashx extension is the default HttpHander file extension set up by ASP.NET.

Remember that HttpHandlers must be mapped to a unique file extensions. But luckily in asp.net 2.0, they have .ashx file extension that specifically created for HttpHandler purpose. This will save you heaps of time configuring and adding new file extension on your web.project

Outputting an image from HttpHandler


<@ WebHandler Language="VB" Class="Handler"/>

Imports System.Web


Public Class Handler:Implements IHttpHandler


   Public Sub ProcessRequest(ByVal context as HttpContext) _

            Implements IHttpHandler.ProcessRequest

         context.Response.ContentType = "image/jpeg"

         context.Response.WriteFile("Sunset.jpg")

   End Sub 


   Public ReadOnly Property IsReusable() As Boolean _

          Implements IHttpHandler.IsReusable

        Get

            Return False

        End Get

   End Property

End Class


<@ WebHandler Language="C#" Class="Handler"/>

using System.Web

    public class Handler:IHttpHandler {

         public void ProcessRequest(HttpContext context) {              

             context.Response.ContentType = "image/jpeg";

             context.Response.WriteFile("Sunset.jpg");

    }

    public bool IsReusable {

        get{

           return false;

        }

    }

}


As you can see, simply change the ContentType method to image/jpeg to indicate that you are returning JPEG image, then you use the WriteFile() method to write an image file to the output stream.

To use the handler, you can directly called the .ashx file from your html code

Conclusion


The article above is basically an introduction to the HttpHandler and HttpModules. Lots of ASP.NET developers until now never use and never heard about HttpHandlers and HttpModules. The reason is because they keep applying the old way and old technology from Classic ASP 3.0. You can do the similar thing without the need of using HttpHandler and HttpModules. However using HttpHandler and HttpModules allow your website to be more manageable, extensible and less code written in your presentation layer. You encapsulate all the logic inside the HttpHandler and HttpModules. Thats all for now. Happy programming !

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET 4 Hosting - ASPHostPortal :: How to Backup and Restore Database in ASP.NET

clock June 27, 2011 08:00 by author Jervis

Introduction

Sometimes we need to provide backup and restore facility in ASP.NET application in application's control panel. In this article, I am going to explain how to develop a database backup and restore application in ASP.NET. I have taken example of SQL Server in this article however, this application can be used to backup and restore any database that .NET supports. You just need to change their provider instead of System.Data.SqlClient and a single SQL Statement to list the table names of the database. I will explain them in details later in this article.

My Backup and Restore web application looks like below:



Let us develop this application in few easy steps.

1. Create a UI for database backup and restore

In this step, let us create a simple UI in ASP.NET to list all the database tables in the ListBox control that let the end user select the table to take backup and restore. Also put two buttons named Backup and Restore to do its respective functionality. My code for above UI looks like below:

<form id="form1" runat="server">
<div>
<table cellpadding="2" cellspacing="1" border="1" style="border-collapse: collapse;">
<tr>
<th style="background-color:#e0e0e0;">
Backup and Restore SQL Server
<br />
database using ASP.NET</th>
</tr

<tr>
<td align="Center">
List of Tables</td>
</tr

<tr>
<td align="Center">
<asp:ListBox ID="ListBox1" Rows="10" runat="Server" DataTextField="table_name" DataValueField="table_name">
</asp:ListBox>
</td>
</tr

<tr>
<td align="Center">
<span onclick="return confirm('Are you sure to backup selected table?')">
<asp:Button ID="btnBackup" runat="Server" Text="Backup" OnClick="BackUpNow" />
</span>
<span onclick="return confirm('Are you sure to restore selected table?')">
<asp:Button ID="btnRestore" runat="Server" Text="Restore" OnClick="RestoreNow" />
</span>
</td>
</tr>
</table> 

<asp:Label ID="lblMessage" runat="Server" EnableViewState="False" ForeColor="Blue"></asp:Label

</div>
</form>

2. Populate the database table in the ListBox control

In this step, we will write method that will populate all database tables in the ListBox control that will let the end user select the table to perform Backup or Restore. My code looks like below:

string connStr = ConfigurationManager.AppSettings["DatabaseToBackup"].ToString(); 

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
PopulateDatabaseTables();
}
}
/// <summary>
/// Populate database tables first
/// </summary>
private void PopulateDatabaseTables()
{
string tableName = string.Empty;
string sql = "SELECT *, name AS table_name " +
" FROM sys.tables WHERE Type = 'U' ORDER BY table_name";
using (SqlConnection conn = new SqlConnection(connStr))
{
using (DataTable table = new DataTable())
{
conn.Open();
using (SqlDataAdapter dAd = new SqlDataAdapter(sql, conn))
{
dAd.Fill(table);
}
ListBox1.DataSource = table;
ListBox1.DataBind();
}
}
}

You can notice in the above code snippet, I am calling a method named PopulateDatabaseTables() in the Not IsPostBack condition under Page_Load event that will populate all the tables of the database in the ListBox control. Notice the select statement that has been stored into sql variable. This select statement varies between databases to databases. To list all the tables in SQL Server database, you need to use above select statement. To list all the tables of the MySQL database, you need to write "show tables" in place of above select statement. Of course, you need to change the provider as well to connect to the MySQL database.

3. Code for taking backup of the selected table

In this step, we shall write code to take backup of the selected table when Backup button will be clicked. You can see that in OnClick event of the Backup button, I have specified BackupNow method. Let us see the code for this method.

/// <summary>
/// Backup the selected table
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void BackUpNow(object sender, EventArgs e)
{
string tableName = ListBox1.SelectedValue;
using (DataSet dSetBackup = new DataSet())
{
using (SqlConnection conn = new SqlConnection(connStr))
{
using (SqlDataAdapter dAd = new SqlDataAdapter("select * from " + tableName, conn))
{
dAd.Fill(dSetBackup, tableName);
}
}
dSetBackup.WriteXml(Server.MapPath("~/backup/" + tableName + ".xml"));
lblMessage.Text = "Backup for table <b>" + tableName + "</b> successful!";
}
}

In the above code snippet, I have got the selected table name form ListBox in the tableName variable. Selected all records from that table and filled into a DataSet named dSetBackup. Later on I used WriteXml method of DataSet to write the contents of the selected table in an xml file. The name of the xml file will be the table name in my case and will be placed in the backup folder. Then I have written a success message. This way your end user will be able to take backup of all the tables in the database.

4. Code for restoring selected table

In this step, we shall see how to restore a selected table into the database once the Restore button will be clicked. Notice the Restore button where I have specified RestoreNow method in the OnClick event. The code for this method looks like below:

/// <summary>
/// Restore the selected table
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void RestoreNow(object sender, EventArgs e)
{
string
restoreConnStr =
ConfigurationManager.AppSettings["RestoreConnStr"].ToString();

string tableName = ListBox1.SelectedValue;
using (SqlConnection conn = new SqlConnection(restoreConnStr))
{
using (DataSet dSetBackup = new DataSet())
{
// get the schema of the selected table from the database to restore
using
(SqlDataAdapter dAd = new SqlDataAdapter("select * from " + tableName,
conn))

{
     // Following line will get the schema of the selected table in the dSetBackup DataSet
     dAd.Fill(dSetBackup, tableName); 

// get the data for selected table from backed up XML file
using (DataSet dSet = new DataSet())
{
dSet.ReadXml(Server.MapPath("~/backup/" + tableName + ".xml"));
// Loop through all rows of the selected table and add into dSetBackup DataSet
foreach (DataRow row in dSet.Tables[0].Rows)
{
dSetBackup.Tables[0].NewRow();
dSetBackup.Tables[0].Rows.Add(row.ItemArray);


// Create a command builder to update dSetBackup DataSet
SqlCommandBuilder cmd = new SqlCommandBuilder(dAd); 

// Following update command will push all added rows of dSetBackup DataSet into the database
dAd.Update(dSetBackup, tableName); // We are done !!!
}
}
lblMessage.Text = "Restore of table <b>" + tableName + "</b> successful!";
}
}
}

Please note that in order to above code snippet work, you must have the schema in place into the Restore database. This schema must match the original database schema from which you had taken backup otherwise your restore will not work.

In the above code snippet, I am first getting the connection string of the database where we need to restore the data. Then I am getting the schema of the selected table into the dSetBackup DataSet using dAd (SqlDataAdapter), as there will not be any row into the restore database, so it will only give the schema of the table. This will help us to push the backed up data into this DataSet. In the next line, I have read the backed up xml of the table using ReadXml method of the DataSet that will get all the backed up data for that table into the dSet DataSet. In next line, I am looping through every rows of the dSet DataSet table and adding them into our dSetBackup DataSet. Next, I have created a SqlCommandBuilder object for the SqlDataAdapter. This will internally build insert, update, delete statement for the dSetBackup DataTable. In the following line, I have used dAd.Update (SqlDataAdapter update method) to push the data into the restore database. At last I am writing the success message. Simple! Isn't it?

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.


You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

- DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



ASP.NET Ajax Hosting - ASPHostPortal :: How to Fix Element 'ScriptManager' is not a known element in ASP.NET AJAX

clock June 24, 2011 07:42 by author Jervis

This is brief tutorial about how to fix Element ‘ScriptManager’ is not known element.

Change this in your web.config:

<controls>
        <add tagPrefix="asp" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add tagPrefix="asp" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>
        <add tagPrefix="asp" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>
</controls>


To this:

<controls>
        <add tagPrefix="ajax" namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add tagPrefix="ajax" namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
        <add tagPrefix="ajax" namespace="Microsoft.Web.Preview.UI" assembly="Microsoft.Web.Preview"/>
        <add tagPrefix="ajax" namespace="Microsoft.Web.Preview.UI.Controls" assembly="Microsoft.Web.Preview"/>
 </controls>


Hope it helps. Please note I use the CTP web.config configuration.

Reasons why you must trust ASPHostPortal.com

Every provider will tell you how they treat their support, uptime, expertise, guarantees, etc., are. Take a close look. What they’re really offering you is nothing close to what ASPHostPortal does. You will be treated with respect and provided the courtesy and service you would expect from a world-class web hosting business.

You’ll have highly trained, skilled professional technical support people ready, willing, and wanting to help you 24 hours a day. Your web hosting account servers are monitored from three monitoring points, with two alert points, every minute, 24 hours a day, 7 days a week, 365 days a year. The followings are the list of other added- benefits you can find when hosting with us:

-
DELL Hardware
Dell hardware is engineered to keep critical enterprise applications running around the clock with clustered solutions fully tested and certified by Dell and other leading operating system and application providers.
- Recovery Systems
Recovery becomes easy and seamless with our fully managed backup services. We monitor your server to ensure your data is properly backed up and recoverable so when the time comes, you can easily repair or recover your data.
- Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account. You’ll use a flexible, powerful hosting control panel that will give you direct control over your web hosting account. Our control panel and systems configuration is fully automated and this means your settings are configured automatically and instantly.
- Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business. We have not just been providing hosting for many clients for years, we have also been researching, developing, and innovating every aspect of our operations, systems, procedures, strategy, management, and teams. Our operations are based on a continual improvement program where we review thousands of systems, operational and management metrics in real-time, to fine-tune every aspect of our operation and activities. We continually train and retrain all people in our teams. We provide all people in our teams with the time, space, and inspiration to research, understand, and explore the Internet in search of greater knowledge. We do this while providing you with the best hosting services for the lowest possible price.
- Data Center
ASPHostPortal modular Tier-3 data center was specifically designed to be a world-class web hosting facility totally dedicated to uncompromised performance and security
- Monitoring Services
From the moment your server is connected to our network it is monitored for connectivity, disk, memory and CPU utilization – as well as hardware failures. Our engineers are alerted to potential issues before they become critical.
- Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.
- Security
Network security and the security of your server are ASPHostPortal’s top priorities. Our security team is constantly monitoring the entire network for unusual or suspicious behavior so that when it is detected we can address the issue before our network or your server is affected.
- Support Services
Engineers staff our data center 24 hours a day, 7 days a week, 365 days a year to manage the network infrastructure and oversee top-of-the-line servers that host our clients’ critical sites and services.



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)

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

Tag cloud

Sign in