ASPHostDirectory Cheap .NET 4 Hosting

Blog about .NET Hosting and all its latest technology

ASPHostDirectory.com .NET 4 Hosting :: What's New in C# and .NET 4

clock July 6, 2010 05:55 by author Darwin

While .NET 3.0 and 3.5 were great additions to the .NET framework, they were built against the 2.0 Common Language Runtime (CLR). Now, Microsoft has released .NET 4 – in addition to a new CLR, we've got a ton of framework and language improvements. We'll cover some of those changes here and will continue to cover .NET 4 in future articles.

C# Language


Let's start by covering a few of the new features of the C# language. After that, we'll check out some IDE enhancements to make your C# development experience more productive.

Named and Optional Arguments

With support for named arguments, you can reduce the amount of typing you need to do when calling a method (or indexer, constructor or delegate).

Let's say you have a method with 4 arguments (x, y, width and height). And because this API was designed nicely, the arguments are actually named "x", "y", "width" and "height". When it comes time to calling that method, if you can only remember the argument names but not their position, named arguments will help:


CalulateIntersection(x: 20, y: 30, height: 10, width: 4);

Or maybe it was width and height that went first?

CalulateIntersection(height: 10, width: 4, x: 20, y: 30);

With named arguments, both of these calls are equivalent and pass the same data to the method.

Optional arguments allow you to specify a default value for an argument. The default value will be used if the caller does not provide a value for the optional parameter. The syntax is simple:

public void MakeBeta(int value, string name = "Beta1", string version = "1.0")

In the method signature above, name and version are optional. If not supplied by the caller, "name" will get the value "Beta1" and "version" will be "1.0". Even though optional parameters are, um, optional, you can't leave them out altogether. If you wanted to call "MakeBeta" with the default name but a specific version, you can use named arguments:

MakeBeta(34, version: "2.4");

If you've done any COM-interop, especially with the Microsoft Office COM API's, you'll quickly see how powerful optional and named arguments will be to you. Before named arguments, you had to use Type.Missing for optional parameters:

excelApp.get_Range("A5", "C7").AutoFormat(myFormat, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing);


Now you can take advantage of named arguments and simply supply the format argument:

excelApp.get_Range("A5", "C7").AutoFormat(format:myFormat);

Dynamic keyword

The "dynamic" keyword allows you to define a type that has its type checking done at runtime rather than compile time. Why would you want to wait until runtime to do your type checking? It allows your application to be more flexible: You don't care where an object came from – COM interop, reflection, a dynamic language like IronPython – you just want to manipulate it.


Consider this example:

public void DoSomething(dynamic x)
      {
            x.ShowSample();
      }

Since "x" is defined as dynamic, no compile-time checks are done. At runtime, the code will work only if the object passed in supports a "ShowSample" method that takes no arguments. It doesn't matter what the type is – as long as it has a "ShowSample" method.

Why defer type checking to runtime? The biggest reason is COM-interop. If you look at some of the Microsoft Office Automation API interfaces, there are a lot of variables and return types defined as "object". This is because the API's were originally designed for a non-type-safe language: VBScript.


With .NET's adherence to strong typing, interop with COM API's like the Microsoft Office API's requires a lot of casting to various interfaces and classes in both method calls as well as return types. It made the code tedious to write and difficult to read.


With the dynamic keyword, we can let the runtime do the type checking and casting for us. A call to set or get the value of a range used to look something like this:

      ((Microsoft.Office.Interop.Excel.Range)excelApp.Cells[5, 5]).Value = "Language";
      var languageRange = (Microsoft.Office.Interop.Excel.Range)excelApp.Cells[5, 5];


Now, by defining the "excelApp" variable as "dynamic", we can let the runtime do the type checking and there is no longer a need to satisfy the compiler with casting:

      excelApp.Cells[5, 5].Value = "Language";
      var languageRange = excelApp.Cells[5, 5];

Type Equivalence Support

Type Equivalence Support (or "Type Embedding") allows you to avoid a major pitfall of writing clients against strongly-type interop assemblies; that is, when a new version of the strongly-typed interop assembly is released, you have to recompile your client – even if you're not using any of the new features.

With type embedding, you can actually embed type information into a client. So if the type information changes on the target machine (because the user upgraded to the next version of Microsoft Office, for example), the type information embedded into the client can be used without the need to recompile the client application.

A simple example of how this works is beyond the scope of this article. See the MSDN documentation on "Walkthrough: Embedding Types from Managed Assemblies" for a complete explanation and sample code.


Covariance and Contravariance

This is one of those tricky things that could take up an entire article. As a matter of fact, former "C# Corner" author Bill Wagner did just that back in May of 2009. His article, "Generic Covariance and Contravariance in C# 4.0" provides an in-depth look at how C# handles type conversions and decides which ones are allowed and which aren't.

C# IDE

The C# language wasn't the only part of C# that was improved. Microsoft spent a lot of time on Visual Studio as well. The IDE shell was rewritten in WPF (ever heard of the term "eating your own dog food?") and uses MEF (Managed Extensibility Framework) to offer even more extensibility points. Here are a few C# IDE enhancements in 2010.

Generate From Usage

As a fan of test-first development, I like the new "Generate From Usage" feature.


Let's say we’re writing a simple banking application and we need to write some code to transfer some money between two accounts. Let’s start with a unit test:

      [TestMethod]
      public void TransferFundsTest()
      {
            Account source = new Account() {Balance = 300.0};
            Account destination = new Account() {Balance = 100.0};
            var xferService = new XferService();

            xferService.Transfer(source, destination, 50.0);

            Assert.AreEqual(250, source.Balance);
            Assert.AreEqual(150, destination.Balance);
      }

Lots of errors in there! That’s because we haven’t even written an Account class or an XferService class. Visual Studio can help us start generating some code based on our unit test.

Right-click on the one of the red "Account" instances and select "Generate" and then "Class". Visual Studio generates a simple Account class with no members. Now right-click on one of the red "Balance" references and select "Generate" and then "Property". Our Account class now has a simple get/set Balance field. Repeat these same steps with XferService and the Transfer method. Without too much work, we’ve got the following code generated from our unit tests:


      class Account
      {
            public double Balance { get; set; }
      }

      class XferService
      {
            internal void Transfer(Account source, Account destination, double p)
            {
                  throw new NotImplementedException();
            }

}

Reference Highlighting

Reference Highlighting adds a nice navigational feature to the IDE. Select any word in the IDE. You’ll notice that all instances of that word are highlighted in the code editor. It’s a quick way to show you where usages of that word object (class, variable, method, property) can be found. And you can navigate between all highlighted instances with CTRL+SHIFT+DOWN ARROW and CTRL+SHIFT+UP ARROW.

Conclusion

All in all, Microsoft has done a very nice job of putting lots of features into both C# and the Visual Studio IDE. Remember, this article covered just a few of the highlights. So, if you’re looking for ASP.NET 4.0 hosting, you can choose ASPHostDirectory as the alternatives. You can start from $ 3.99/month to get the professional ASP.NET 4.0 hosting. What are you waiting for?

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting - Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: New Syntax for HTML Encoding Output in ASP.NET 4 (and ASP.NET MVC 2)

clock July 6, 2010 05:52 by author Darwin

Today’s post covers a small, but very useful, new syntax feature being introduced with ASP.NET 4 – which is the ability to automatically HTML encode output within code nuggets.  This helps protect your applications and sites against cross-site script injection (XSS) and HTML injection attacks, and enables you to do so using a nice concise syntax.

HTML Encoding

Cross-site script injection (XSS) and HTML encoding attacks are two of the most common security issues that plague web-sites and applications.  They occur when hackers find a way to inject client-side script or HTML markup into web-pages that are then viewed by other visitors to a site.  This can be used to both vandalize a site, as well as enable hackers to run client-script code that steals cookie data and/or exploits a user’s identity on a site to do bad things.

One way to help mitigate against cross-site scripting attacks is to make sure that rendered output is HTML encoded within a page.  This helps ensures that any content that might have been input/modified by an end-user cannot be output back onto a page containing tags like <script> or <img> elements. 

How to HTML Encode Content Today

ASP.NET applications (especially those using ASP.NET MVC) often rely on using <%= %> code-nugget expressions to render output.  Developers today often use the Server.HtmlEncode() or HttpUtility.Encode() helper methods within these expressions to HTML encode the output before it is rendered.  This can be done using code like below:

<div class=”article-content”>
        <%= Server.HtmlEncode(Model.Content) %>
</div>

While this works fine, there are two downsides of it:

1. It is a little verbose
2. Developers often forget to call the Server.HtmlEncode method – and there is no easy way to verify its usage across an app

New <%: %> Code Nugget Syntax

With ASP.NET 4 we are introducing a new code expression syntax (<%:  %>) that renders output like <%= %> blocks do – but which also automatically HTML encodes it before doing so.  This eliminates the need to explicitly HTML encode content like we did in the example above.  Instead, you can just write the more concise code below to accomplish the exact same thing:

<div class=”article-content”>
       <%: Model.Content %>
</div>

We chose the <%: %> syntax so that it would be easy to quickly replace existing instances of <%= %> code blocks.  It also enables you to easily search your code-base for <%= %> elements to find and verify any cases where you are not using HTML encoding within your application to ensure that you have the correct behavior. application to ensure that you have the correct behavior.

Avoiding Double Encoding

While HTML encoding content is often a good best practice, there are times when the content you are outputting is meant to be HTML or is already encoded – in which case you don’t want to HTML encode it again. 

ASP.NET 4 introduces a new IHtmlString interface (along with a concrete implementation: HtmlString) that you can implement on types to indicate that its value is already properly encoded (or otherwise examined) for displaying as HTML, and that therefore the value should not be HTML-encoded again.  The <%: %> code-nugget syntax checks for the presence of the IHtmlString interface and will not HTML encode the output of the code expression if its value implements this interface.  This allows developers to avoid having to decide on a per-case basis whether to use <%= %> or <%: %> code-nuggets.  Instead you can always use <%: %> code nuggets, and then have any properties or data-types that are already HTML encoded implement the IHtmlString interface.

Using ASP.NET MVC HTML Helper Methods with <%: %>

For a practical example of where this HTML encoding escape mechanism is useful, consider scenarios where you use HTML helper methods with ASP.NET MVC.  These helper methods typically return HTML.  For example: the Html.TextBox() helper method returns markup like <input type=”text”/>.  With ASP.NET MVC 2 these helper methods now by default return HtmlString types – which indicates that the returned string content is safe for rendering and should not be encoded by <%: %> nuggets. 

This allows you to use these methods within both <%= %> code nugget blocks:

<%= Html.TextBoxFor(article=>article.Content) %>

As well as within <%: %> code nugget blocks:

<%: Html.TextBoxFor(article=>article.Content) %>

In both cases above the HTML content returned from the helper method will be rendered to the client as HTML – and the <%: %> code nugget will avoid double-encoding it.

This enables you to default to always using <%: %> code nuggets instead of <%= %> code blocks within your applications.  If you want to be really hardcore you can even create a build rule that searches your application looking for <%= %> usages and flags any cases it finds as an error to enforce that HTML encoding always takes place.

Scaffolding ASP.NET MVC 2 Views

When you use VS 2010 (or the free Visual Web Developer 2010 Express) to build ASP.NET MVC 2 applications, you’ll find that the views that are scaffolded using the “Add View” dialog now by default always use <%: %> blocks when outputting any content.  For example, below I’ve scaffolded a simple “Edit” view for an Article object.  Note the three usages of <%: %> code nuggets for the label, textbox, and validation message (all output with HTML helper methods):

<h2>Edit Article</h2>

<% using (Html.BeginForm()) {%>

         <fieldset>

                <div class=”editor-label”>
                       <%: Html.LabelFor(model => model.Content) %>
                </div>
                <div class=”editor-field”>
                       <%: Html.TextBoxFor(model => model.Content) %>
                       <%: Html.ValidationMessageFor(model => model.Content) %>
                </div>

Summary

The new <%: %> syntax provides a concise way to automatically HTML encode content and then render it as output.  It allows you to make your code a little less verbose, and to easily check/verify that you are always HTML encoding content throughout your site.  This can help protect your applications against cross-site script injection (XSS) and HTML injection attacks. If you looking for ASP.NET 4.0 hosting, you only need to pay $ 3.99/month to get ASP.NET 4.0 hosting. You only get this opportunity in ASPHostDirectory.

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: New Data Visualizations in SQL Server Reporting Services 2008 R2

clock July 3, 2010 06:45 by author Darwin

New Data Visualizations in SQL Server Reporting Services 2008 R2 how they can help you effectively communicate insights in your data.

Maps.  Maps can be very powerful visualizations.  They can consume and visualize SQL Server geospatial and geometry data directly “regular” data, and combine multiple datasets using map layers.  Maps can integrate ESRI shape files, as well as directly integrate with Bing Maps. 

Sparklines.  Sparklines are defined as “data intense, word-sized graphics” and are commonly used in tables to show trends. 

Data Bars.  Data bars, much like sparklines, are small charts typically found in the cells of a matrix or table.  Instead of containing many values though, they usually contain one or just a few values.

Indicators.  Indicators are small icons you can use to denote status or trends in your reports. While Report Builder 3.0 contains several pre-configured indicators, you can mix and match icons from different indicator sets to create your own unique sets.  You can even provide your own images to be used as indicators!  Indicators can also be embedded inside gauge report items. 

If you like to host your SSRS 2008 R2 hosting, you can choose ASPHostDirectory as the alternatives. You can get the best service wit an affordable price.

What is so SPECIAL on ASPHostDirectory.com Reporting Service Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in Reporting Service Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: What is New in Microsoft SQL Server 2008 R2 Reporting Services

clock July 3, 2010 06:41 by author Darwin

Microsoft has released MS SQL Server 2008 R2 recently. At ASPHostDirectory, you can find the product at an affordable price. Check it out. This topic give brief explanation about new features in SSRS 2008 R2. If you looking for hosting, ASPHostDirectory always ready to host your site. New features in SSRS 2008 R2:

Shared Data Sets

Just as Shared Data Sources, with the release of SQL Server 2008 R2 now datasets can be shared between reports. So called Shared Data Sets can be stored individually, shared, processed and cached. Shared Data Sets management can be easily managed using Reporting Services Management screens.

Report Part Gallery

Microsoft SQL Server 2008 R2 enables to seperate a report into parts using Visual Studio Report Designer (BIDS - Business Intelligence Development Studio) or Report Builder 3.0. BI developers can place each part of an .rdl report into a Report Part gallery. Placing report parts means publish and sharing SSRS report components. Report parts in Report Part gallery can be re-used by developers and report authors in other reports. Working with report parts is as easy as simply drag and drop report parts onto the report design layout.

Sparklines, Data Bars and Indicators

Microsoft SQL Server 2008 R2 ha new virtual components to make your reports better. These new virtual controls include sparklines, data bars and indicators. These controls are in-cell controls which means sparklines and databars are charts that are one cell in size. Using spark lines, databars and indicators are very easy so that even power users that are not from IT background can use these controls without any problem. Report authors can choose indicators from a large set of indicators gallery suitable for their report.

Aggregation on Aggregates

Aggregation on aggregates
mean nested aggregate expressions in your reporting services formules.

Rendering features

SQL Server 2008 R2 introduces BI developers with new rendering features.
For example, report authors can now rotate text in 270 degrees. We had once required this feature to use on data table headers.
Another rendering feature is related page numbering. Developers now have a better control on page numbers.
Reporting Services authors can now name Excel worksheets after exporting Reporting Services reports to Excel.
An other feature is conditional check on Rendering Format. This means developers can develop code according to RenderFormat using expression Globals!RenderFormat.Name

Browser Support

With the release of SQL Server 2008 R2 Reporting Services now supports browsers other than Internet Explorer.


What is so SPECIAL on ASPHostDirectory.com Reporting Service Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in Reporting Service Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: How to Deploy a Database With a Web Application Project

clock June 30, 2010 06:22 by author Darwin

When you prepare to deploy a Web application project that uses one or more SQL Server databases, you can enter settings that specify database scripts that must run during deployment. These settings apply whether you deploy by using one-click publish or by using a Web deployment package.

The first two procedures in this topic provide instructions for specifying database information to deploy when the database does not already exist in the destination environment. The remaining procedures explain how to change the settings after the application has already been deployed. After you deploy an application the first time, the database will already be on the destination server. You might not want to run database scripts, or you might want to run different scripts.

Configuring for First-Time Deployment

You use the Package/Publish SQL tab of the project Properties page to configure settings that determine which scripts will run during deployment. This tab is organized in a master/detail layout. In a grid at the top, you specify databases to deploy. In the rest of the tab, you specify settings that apply to the database you have selected in the grid.

To specify databases to deploy

1. In Solution Explorer, select the project name and then select Properties.

2. In the Properties page, click the Package/Publish SQL tab.

3. In the Configuration drop-down list, select the build configuration that you want to deploy.

You can configure deployment for the Debug or Release build configurations, or for a custom build configuration that you have created by using the Configuration Manager dialog box. For example, you might want different settings for deploying to a test server and for deploying to a production server.

The default value for the Configuration list is Active. This means that the settings on this tab will apply to the build configuration that is currently selected for the project. The currently selected build configuration is shown in the main toolbar and in the Configuration Manager dialog box. (To open Configuration Manager, select it from the Build menu.)

4. Click Import from Web.config.

A row is created in the grid for each connection string that is found in the Web.config file. By default, "-Deployment" is appended to the connection string name.

5. If the Web application uses databases that are not represented by connection strings in the Web.config file, manually add a row for each of those databases. For rows that you enter manually, you can use any name that helps you remember which database the row applies to.

After you have specified the databases to deploy, you can enter settings for each database. Perform the following steps for each database that you entered in the Database Entries grid.

To enter settings for a database

1. In the Database Entries grid, select the row that you want to enter settings for.

The values that you enter in the Database Entry Details section apply only to the currently selected row in the Database Entries grid. If no rows are selected in the Database Entries grid, the Database Entry Details section is disabled.

2. In the Connection string for destination database box, enter the connection string to use during deployment.

This connection string might be different from the one that you use in the deployed Web.config file for the same database. For example, the connection string to use for deployment might need administrator permissions that you do not want the connection to have when users run the application.

3. If you want to automatically generate scripts from an existing database, select the Pull data and/or schema from an existing database check box.

By default, this check box is selected for rows in the Database Entries grid that were imported from the Web.config file. When this option is selected, the Database Scripts grid includes a row to indicate that automatically generated scripts will run in the destination database.

4. If you selected the Pull data and/or schema from an existing database check box, perform the following steps:

- In the Connection string for the source database text box, enter the connection string to use during deployment.

By default, for rows in the Database Entries grid that were imported from the Web.config file, this field is initialized to the value from the Web.config file.

- In the Database scripting options drop-down list, specify whether you want the scripts that are automatically generated for this database to duplicate only the database structures (Schema Only), to duplicate both the structures and the data (Schema and Data), or to duplicate only the data (Data Only) in the destination environment.

5. If you want to specify custom database scripts to run in the destination database during deployment, add them to the Database Scripts grid by using the Add Script button.

When you click Add Script, a Select File dialog box is displayed. This dialog box enables you to select a script that you have written and to add it to the Database Scripts grid.

6. If the rows in the Database Scripts grid are not in the order in which the scripts should run, rearrange the rows by using the up arrow and down arrow buttons.

7. In the Web.config transform file for the build configuration that you are deploying, add markup that will transform the connection string for this database to the value that it should have in the deployed Web application.

8. If you do not want the automatically generated script to run in a transaction, edit the project file to set the Transacted attribute of the script's Source element to False.

9. If the source or destination database is SQL Azure and if you are running an automatically generated script, edit the script's PreSource element in the project file so that it includes the following attributes:

targetDatabaseEngineType=SQLAzureDatabase

targetServerVersion=version100

prefetchObjects=false

Set the targetServerVersion to version100 for SQL 2008 or version105 for SQL 2008 R2.

Redeploying Without Database Changes

After you have deployed a Web application the first time, you might have to deploy it again. The following procedure describes how to disable database updates for all databases or for selected databases when you redeploy the Web application.

To redeploy without database changes

1. In Solution Explorer, right-click the project name and then click Properties.

2. Click the Package/Publish Web tab.

3. Make sure that the build configuration that you want to change settings for is selected in the Configuration drop-down list.

4. If you want to disable updating for all databases that are listed in the Database Entries grid, clear the Include all databases configured in Package/Publish SQL tab check box.

5. If you want to disable updating for selected databases that are listed in the Database Entries grid, clear the Deploy check box for each database that you do not want to run scripts for.

Redeploying By Using Automatically Generated Scripts

After you have deployed a database by using automatically generated scripts, you might make database changes and then redeploy the database. In that case, the deployment process must drop existing database objects before the objects are re-created. The following procedure describes how to specify that automatically generated scripts should include SQL Drop statements.

To redeploy a database by using automatically generated scripts

If you want the automatically generated script to drop database objects such as tables, views, and stored procedures individually before it creates new versions of these objects, edit the project file to set the ScriptDropsFirst attribute of the PreSource element of the automatically generated script to True.

This setting causes a SQL Drop statement to be generated for each database object that is created from the source database. This Drop statement for a particular object will run just before the statement that creates that object. If an object occurs in the destination database but not in the source database (typically because it was dropped from the source database after the previous deployment), no Drop statement will be generated for it.

If you want to drop the entire database before re-creating individual database objects, set the DropDestinationDatabase attribute of the Source element to True.

Deploying Database Changes by Using Custom Scripts

After you have deployed a database, you might make database changes and then want to deploy only the changes to the destination database. This lets you preserve any data that might have been entered in the destination database. The following procedure describes how to disable automatically generated scripts and add custom scripts that update the database.

To deploy changes to a database and preserve data

1. Create custom database scripts that will make the changes that you want in the destination database.

2. In Solution Explorer, right-click the project name and then select Properties.

3. Click the Package/Publish SQL tab.

4. In the Database Scripts grid, clear the Include check boxes in the rows for scripts that should not run.

If you selected the Pull data and/or schema from an existing database check box, clear the Include check box for the automatically generated script.

5. Add the custom database scripts for the selected database by using the Add Script button.

When you click Add Script, a Select File dialog box is displayed that enables you to select a script that you have written and add it to the Database Scripts grid. By default, the Include check box will be selected.

6. Optionally, if the rows in the Database Scripts grid are not in the order in which the scripts should run, rearrange the rows by using the up arrow and down arrow buttons.

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory ASP.NET Hosting :: New Features in ASP.NET 4.0

clock June 12, 2010 06:26 by author Darwin

This topic contains information about new features in ASP.NET 4.0. This topic doesn’t provide comprehensive information about all new features and is subject to change. So, if you seek more information about ASP.NET 4.0, you can choose ASPHostDirectory as alternatives. You’ll get the best service at an affordable price. Only with @ 3.99/month, you can directly get the services you want. So, what are you waiting for? Try it!!

Adding MetaKeyword and MetaDescription Using Page object

Meta keywords and description are most important components of a page when we want to make it search engine friendly. Every search engine will look for these tags to know more information of the page contents. ASP.Net 2.0 introduced a new feature where one can add these tags from the code behind using HtmlMeta class. It would have been better if we are able to do this through Page directive (Page class).  ASP.Net 4.0 added 2 new properties on the Page object to let you define the Meta keywords and Description.

Refer the code below,

protected void Page_Load(object sender, EventArgs e)

    {

        Page.MetaKeywords = "asp.net,C#";

        Page.MetaDescription = "This is an asp.net site that hosts asp.net tutorials.";

    }

OR

<%@ Page Language="C#" AutoEventWireup="true" MetaKeywords="asp.net,C#" MetaDescription="This is an asp.net site that hosts asp.net tutorials" CodeFile="Default.aspx.cs" Inherits="_Default" %>

More Control on Controls ViewState

ViewState is one of the important factors if we start looking at improving the performance our asp.net site.  Till ASP.Net 3.x, we have EnableViewState property both at Page level and server control level to control the view state. Disabling the ViewState at page level will disable the viewstate to all the page controls. In order to improve the performance, one need to switch off the viewstate for individual control for which saving the viewstate is not necessary and hence disabling viewstate at page level is not a suitable option.  To overcome this difficulty, asp.net 4.0 added a new property to Page object and controls called ViewStateMode.

This property can take 3 values,

1. Enabled
This value will enable the view state. This is the default value for the Page object.

2. Disabled
This value will disable the viewstate

3. Inherit
This value will make the control to inherit the setting of the parent. This is the default value for a control.

With this property, we can disable the viewstate for the page and enable it for the control if only required.

Consider the following code,

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ViewStateTest.aspx.cs" ViewStateMode="Disabled" Inherits="ViewStateTest" %>

    <form id="form1" runat="server">

    <div>

        <asp:Label ID="Label1" runat="server" ViewStateMode="Enabled" Text="Default Text"></asp:Label>

        <br />

         <asp:Label ID="Label2" runat="server" Text="Default Text"></asp:Label><asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />

     </div>

    </form>

CodeBehind

protected void Page_Load(object sender, EventArgs e)

    {

        if (!IsPostBack)

        {

            Label1.Text = "Text Assigned in CodeBehind";

            Label2.Text = "Text Assigned in CodeBehind";          

        }

    }

When the page executed we will get the following output,

Text Assigned in CodeBehind

Text Assigned in CodeBehind

When the button is clicked,

Text Assigned in CodeBehind

Default Text

Since, the viewstate is disabled at page level (Page object) and the viewstate is enabled for “Label1” we will get the above output on Button click. Please note that if we have not set the value, the default will be “inherit” (for Label2).

Note

If we disabled the viewstate through EnableViewState property, setting any values for ViewStateMode property will make no impact.

ClientID Generation for ASP.Net Controls

In order to access a server control from a client side script, a developer will require getting its client id. Predicting the ClientID of any control that is packed inside a parent like UserControls, MasterPage or any DataBound controls is a challenging task till day. For example, if we have 2 TextBox control inside a page that have an associated MasterPage then the ClientID will be similar to,

<input name="ctl00$ContentPlaceHolder1$TextBox2" type="text" id="ctl00_ContentPlaceHolder1_TextBox2" />

<input name="ctl00$ContentPlaceHolder1$TextBox3" type="text" id="ctl00_ContentPlaceHolder1_TextBox3" />

This is done to make the ID of the control unique in the page.

In earlier versions for asp.net, we can register a server side hidden control which can hold the ClientID of the server control to access it from client side.

ASP.Net 4.0 addresses this difficulty by providing a new property called ClientIDMode for every controls and Page object. We can also set the property in configuration files.

This property will take the following 4 values,

1. Static
Setting this value will make the ClientID same as the ID. It will not concatenate ID of the parent naming containers.

2. Predictable
This will be useful to predict the ClientID of child controls in data controls. Setting this property will prevent the “ctlxxx” prefix in the ClientID. We will see more about this value later in this section.

3. Legacy
This value will make the ClientID generation same as earlier versions of ASP.Net

4. Inherit
This value will make the control to inherit the parent control’s setting. This is the default value for this property.

For example,

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" ClientIDMode="Static"  AutoEventWireup="true" CodeFile="ClientIDs.aspx.cs" Inherits="Default2" %>

This setting will make all the page controls to have ClientID same as ID. For example, if we have 2 Textbox control, the output will be similar to,

<input name="ctl00$ContentPlaceHolder1$TextBox2" type="text" id="TextBox2" />

<input name="ctl00$ContentPlaceHolder1$TextBox3" type="text" id="TextBox3" />

To set this property in Web.Config file/Machine.config file,

<pages clientIDMode="Static"></pages>

The above setting should be inside <System.Web> section.

Child Control’s ClientID in Data Control

For example, if we have child controls inside a ListView control the ClientID will be generated like below by default.

<div id="ListView1_itemPlaceholderContainer" style="font-family: Verdana, Arial, Helvetica, sans-serif;">               

            <span style="background-color: #DCDCDC;color: #000000;">EmpNo:

            <span id="ListView1_ctrl0_EmpNoLabel">1</span>

            <br />

            EmpName:

            <span id="ListView1_ctrl0_EmpNameLabel">Satheesh</span>

            <br />

            Address:

            <span id="ListView1_ctrl0_AddressLabel">2n Cross</span>

            <br />

            City:

            <span id="ListView1_ctrl0_CityLabel">Bangalore</span>

            <br />

            Country:

            <span id="ListView1_ctrl0_CountryLabel">India</span>

            <br />

Because the ListView control has Label control to display data in each column of every row we have SPAN tag with ClientID’s generated.

To make this ID’s predictable from clientside; we can set the ClientIDMode of the ListView control to "Predictable" and ClientIDRowSuffix to one or more number of the columns from the database.  Multiple column names should be a comma separated value. Please note that Repeater control will not support ClientIDRowSuffix property.

Consider the below,

<asp:ListView ID="ListView1" runat="server"

        DataSourceID="SqlDataSource1" ClientIDMode="Predictable" ClientIDRowSuffix="EmpName">

The above setting will remove the prefix “ctlxx” and will append the value of the column specified in ClientIDRowSuffix. This will generate the ClientID’s like,

<div id="ListView1_itemPlaceholderContainer" style="font-family: Verdana, Arial, Helvetica, sans-serif;">

            <span style="background-color: #FFF8DC;">EmpNo:

            <span id="ListView1_EmpNoLabel_Arun">2</span>

            <br />

            EmpName:

            <span id="ListView1_EmpNameLabel_Arun">Arun</span>

            <br />

            Address:

            <span id="ListView1_AddressLabel_Arun">3rd Cross</span>

            <br />

            City:

            <span id="ListView1_CityLabel_Arun">Bangalore</span>

            <br />

            Country:

            <span id="ListView1_CountryLabel_Arun">US</span>

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory ASP.NET Hosting :: Creating a RIA Services Class Library

clock June 7, 2010 07:15 by author Darwin

This topic contains information about key features and improvements in the Silverlight 4. This topic doesn’t provide comprehensive information about all new features and is subject to change. So, if you seek more information about Silverlight 4, you can choose ASPHostDirectory as alternatives. You’ll get the best service at an affordable price. Only with @ 3.99/month, you can directly get the services you want. So, what are you waiting for? Try it!!

To create a Silverlight solution that contains a WCF RIA Services class library

1. In Visual Studio, create a new Silverlight Application named ExampleSilverlightApp.

2. In the New Silverlight Application dialog box, do not enable WCF RIA Services for the application.

The Silverlight application does not need a RIA Services link between the Silverlight project and the server project because the RIA Services link will exist between the projects in the class library.

3. In Solution Explorer, right-click the solution, select Add, and then select New Project.

The Add New Project dialog box appears.

4. In the Silverlight category, select the WCF RIA Services Class Library template and name it AdventureWorksClassLibrary.

5. Click OK.

Your solution now contains four projects as shown in the following illustration.

6. Right-click the ExampleSilverlightApp.Web project and select Add Reference.

The Add Reference dialog box appears.

7. On the Projects tab, select the AdventureWorksClassLibrary.Web project and click OK.

8. Right-click the ExampleSilverlightApp project and select Add Reference.

9. On the Projects tab, select the AdventureWorksClassLibrary project and click OK.

To create the middle-tier library

1. In the AdventureWorksClassLibrary.Web project, add an ADO.NET Entity Data Model named AdventureWorksModel.edmx.

2. In the Entity Data Model Wizard, include the Product table in the entity model.

3. Build the solution.

4. Right-click the AdventureWorksClassLibrary.Web project, select Add, and then select New Item.

5. Select the Domain Service Class template and name it ProductsDomainService.

6. Click Add.

The Add New Domain Service Class dialog box appears.

7. Select Product from the available data models to expose through the domain service and click OK.

8. Build the solution.

9. In Solution Explorer, select Show All Files in each project.

Notice the Generated_Code folder only exists in the AdventureWorksClassLibrary project. Although no code was generated for the ExampleSilverlightApp project, you can still use the generated code from the AdventureWorksClassLibrary project because a project reference exists between the ExampleSilverlightApp and AdventureWorksClassLibrary projects.

To use the generated code in the Silverlight project

1. Right-click the ExampleSilverlightApp project and select Add Reference.

2. Add a reference to the System.ServiceModel.DomainServices.Client assembly.

To find the assembly, select the .NET tab.

3. In the ExampleSilverlightApp project, open the MainPage.xaml.

4. From the Toolbox, drag a DataGrid control to within the Grid element.

An XML namespace and references to Data assemblies are added.

5. Name the DataGridProductsGrid, as shown in the following XAML.

<UserControl

    xmlns:data="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Data" 

    x:Class="ExampleSilverlightApp.MainPage"

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

    mc:Ignorable="d"

    d:DesignHeight="300" d:DesignWidth="400">

    <Grid x:Name="LayoutRoot" Background="White">

      <data:DataGrid Name="ProductsGrid"></data:DataGrid>

    </Grid>

</UserControl>

6. Open the code-behind for MainPage.xaml.

7. Add the following code to retrieve the products.

Imports System.ServiceModel.DomainServices.Client

Imports AdventureWorksClassLibrary.Web

Partial Public Class MainPage

    Inherits UserControl

    Private _productContext As New ProductsDomainContext

    Public Sub New()

        InitializeComponent()

        Dim loadOp = Me._productContext.Load(Me._productContext.GetProductsQuery())

        ProductsGrid.ItemsSource = loadOp.Entities

    End Sub

End Class

8. Open the App.Config file in the AdventureWorksClassLibrary.Web project, and copy individually the <connectionStrings>, <system.serviceModel>, and <httpModules> elements and the elements they contain. Paste each element individually into the Web.config file of the ExampleSilverlightApp.Web project. The Web.config file will look similar to the following example, but your file must provide the relevant connection information for your environment.

This language is not supported, or no code example is available.

9. Run the application.

What is so SPECIAL on ASPHostDirectory.com Silverlight Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in Silverlight Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory ASP.NET Hosting :: Dynamically Using Methods in ASP.NET

clock June 3, 2010 06:36 by author Darwin

This article will show you about information stored in a Type as well as the MethodInfo class and how they can be used to look at and even execute a method without actually calling it yourself. If you seek more information about ASP.NET, you can choose ASPHostDirectory as alternatives. You’ll get the best service at an affordable price. Only with @ 3.99/month, you can directly get the services you want. So, what are you waiting for? Try it!!

Types

Later on we will go into this in greater detail, but this will be just a quick overview here.

You probably know that when you create a class, you are essentially creating a type. A lot of people underestimate the power of a type, you may have used GetType once in a while, but you may not know the underlying power of it. The Type class contains a heck of a lot of information about an type that you can access and then can lead on to some pretty interesting abilities.

System.Reflection

The System.Reflection namespace contains all of the tools needed to provide a view (in code) of any assembly in .NET. If you take a look at the Object Browser in VS.NET, that is the equivalent of using System.Reflection to find out about all of that information. Intellisense in VS.NET is also like using System.Reflection and Lutz Roeder's .NET Reflector uses System.Reflection to browse an assembly.

But why would you use System.Reflection?

Let's say that you were given an assembly and you have no idea what it contains or does, you could use reflection to find out what's in it and how it works.
Or, if you were developing a dynamic documentation system, then you could just place an assembly in the /bin directory and develop an application that used reflection to dynamically generate information and documentation about the assembly (much like the Comment Web Pages with XML Code Comments in VS.NET).

MethodInfo

MethodInfo is a class within System.Reflection that allows you to get information about specific methods (which we will be using in this article). For example, you can give it a method and you can get all sorts of properties and methods back which you can use to examine that method.

Types - GetType

In the following examples, we will be using a simple ASP.NET page with code-behind (because in code-behind the class is clearly defined for you).

GetType returns a Type class with information about a particular type. Examine the following code

Public Class WebForm3
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mtype As System.Type = GetType(WebForm3)
...

mtype now contains information about WebForm3. And if it were to do something like -

Response.Write(mtype.Assembly)
Response.Write("<br>")
Response.Write(mtype.FullName)
Response.Write("<br>")
Response.Write("<table border=""1"">")
Dim member As System.Reflection.MemberInfo
For Each member In mtype.GetMembers
Response.Write("<tr><td>")
Response.Write(member.Name)
Response.Write("</td><td>")
Response.Write(member.MemberType.ToString())
Response.Write("</td></tr>")
Next
Response.Write("</table>")

We probably jumped ahead a bit with the GetMembers call, but all you need to know about it is that it returns an array of MemberInfo objects that contain information about every member in the type. If you take a look at the demo, you will see a lot of methods and properties that you didn't know existed. This is because it not only takes WebForm3, but also -

- System.Web.UI.Page
- System.Web.UI.TemplateControl
- System.Web.UI.Control
- System.Object

MethodInfo

MethodInfo is a class that stores method information and the GetMethod function of System.Type returns a fully loaded MethodInfo class for you to use.

Public Class WebForm3
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mtype As Type = GetType(WebForm3)
Dim minfo As System.Reflection.MethodInfo = mtype.GetMethod("Return1")
End Sub
Public Function Return1(ByVal name As String) As String
Return "Hello " & name
End Function
End Class

This piece of code fills minfo with lots of information about the function Return1.

MethodInfo - Parameters

Take a look at the following code -

Response.Write("<table border=""1"">")
Dim parameter As System.Reflection.ParameterInfo
For Each parameter In minfo.GetParameters()
Response.Write("<tr><td>")
Response.Write(parameter.Name)
Response.Write("</td><td>")
Response.Write(parameter.ParameterType.ToString())
Response.Write("</td></tr>")
Next
Response.Write("</table>")

MethodInfo - Invoking

Now here is the really interesting part - You can also call a method using MethodInfo.

Let's say that you had the name of a method stored in a variable. You can't go - variablename(). So you have to use MethodInfo.

MethodInfo.Invoke takes two parameters - The instance that created the method and the parameters (in an object array).

Take a look at the following code -

Public Class WebForm3
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mtype As Type = GetType(WebForm3)
Dim minfo As System.Reflection.MethodInfo = mtype.GetMethod("Return1")
Dim myparamarray() As Object = {"Sample Name"}    'New
Response.Write(minfo.Invoke(Me, myparamarray))    'New
End Sub
Public Function Return1(ByVal name As String) As String
Return "Hello " & name
End Function
End Class

The two new lines create a parameter array with a field for each parameter and it's value  and then uses minfo.Invoke to call the function and write it's results to the screen. The same would work with a method.

Summary

This article has kind of been your quick introduction to reflection in .NET, but at the same time focused on the aspect of methods and specifically the MethodInfo class. There is a lot more out there on reflection, so check out the documentation on the System.Reflection namespace and see what comes up.

Also, as a quick point of interest, you can actually shorten the entire Page_Load method above to -

Dim myparamarray() As Object = {"Sample Name"}

What is so SPECIAL on ASPHostDirectory.com ASP. Net 4 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in ASP. Net 4 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: What's New in the Visual Studio 2010 Debugger

clock May 26, 2010 08:06 by author Darwin

Here is brief information about Visual Studio 2010. If you looking for Visual Studio 2010, you can always consider ASPHostDirectory. Only with $ 3.99/month, you can get the service you want. So, try it!!

The Visual Studio 2010 debugger has been enhanced by the addition of the following features:

- Breakpoint enhancements, which include the ability to search in the Breakpoints window, the ability to label breakpoints, the ability to import and export breakpoints, and string comparison for breakpoint conditions in native debugging.

- WPF debugging enhancements, which include enhanced tracing that you can use to view events in your WPF application. You can use a WPF Tree Visualizer to inspect and search the WPF tree.

- A newly redesigned Threads window provides filtering, call-stack searching and expansion, and grouping. New columns display affinity masks, process names, and managed IDs. You can customize which columns appear and in what order.

- You can use the Parallel Stacks and Parallel Tasks debugger tool windows to visualize and debug parallel code that is written in C++, C#, or Visual Basic.

- Enhanced DataTips can float on top of other windows or be pinned. DataTips now have a comment field. Floating DataTips that are open persist between debug sessions.

- For dump debugging, a new summary page displays basic information about the contents of the dump file before you start to debug. This page offers quick links to the most common next steps, such as setting your symbol paths and starting to debug. The debugger now fully supports debugging of managed dumps for applications that are using common language-run-time (CLR) version 4.0.

- The Watch window and DataTips provide an icon to warn you when an evaluating an expression requires other threads to run, which can change the program state and cause debug events such as breakpoints to be ignored. If you click the icon, the threads run.

- Enhancements to symbol loading.

- You can now debug mixed-mode native and managed code on 64-bit operating systems.

What is so SPECIAL on ASPHostDirectory.com Visual Studio 2010 Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in VS 2010 Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!

 



ASPHostDirectory.com .NET 4 Hosting :: Creating Custom Routes (VB)

clock May 25, 2010 08:10 by author Darwin

In this tutorial, you learn how to add a custom route to an ASP.NET MVC application. You learn how to modify the default route table in the Global.asax file with a custom route. If you want to be more familiar with ASP.NET MVC, you can always consider ASPHostDirectory. Only with $ 3.99/month, you can get the professional installation. So, what are you waiting for?

In ASP.NET MVC applications, the default route table will work just fine. However, you might discover that you have specialized routing needs. In that case, you can create a custom route.

Imagine, for example, that you are building a blog application. You might want to handle incoming requests that look like this:

/Archive/12-25-2009

When a user enters this request, you want to return the blog entry that corresponds to the date 12/25/2009. In order to handle this type of request, you need to create a custom route.

The Global.asax file in Listing 1 contains a new custom route, named Blog, which handles requests that look like /Archive/entry date.

Listing 1 - Global.asax (with custom route)

Public Class MvcApplication
    Inherits System.Web.HttpApplication

    Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
        routes.IgnoreRoute("{resource}.axd/{*pathInfo}")

        ' MapRoute takes the following parameters, in order:
        ' (1) Route name
        ' (2) URL with parameters
        ' (3) Parameter defaults


        routes.MapRoute( _
            "Blog", _
            "Archive/{entryDate}", _
            New With {.controller = "Archive", .action = "Entry"} _
        )


        routes.MapRoute( _
            "Default", _
            "{controller}/{action}/{id}", _
            New With {.controller = "Home", .action = "Index", .id = ""} _
        )

     End Sub

     Sub Application_Start()
         RegisterRoutes(RouteTable.Routes)
     End Sub
End Class

The order of the routes that you add to the route table is important. Our new custom Blog route is added before the existing Default route. If you reversed the order, then the Default route always will get called instead of the custom route.

The custom Blog route matches any request that starts with /Archive/. So, it matches all of the following URLs:

/Archive/12-25-2009

/Archive/10-6-2004

/Archive/apple

The custom route maps the incoming request to a controller named Archive and invokes the Entry() action. When the Entry() method is called, the entry date is passed as a parameter named entryDate.

You can use the Blog custom route with the controller in Listing 2.

Listing 2 - ArchiveController.vb

Public Class ArchiveController
    Inherits System.Web.Mvc.Controller

    Function Entry(ByVal entryDate As DateTime)
        Return "You requested the entry from " & entryDate.ToString()
    End Function

End Class


Notice that the Entry() method in Listing 2 accepts a parameter of type DateTime. The MVC framework is smart enough to convert the entry date from the URL into a DateTime value automatically. If the entry date parameter from the URL cannot be converted to a DateTime, an error is raised.

Summary

The goal of this tutorial was to demonstrate how you can create a custom route. You learned how to add a custom route to the route table in the Global.asax file that represents blog entries. We discussed how to map requests for blog entries to a controller named ArchiveController and a controller action named Entry().

What is so SPECIAL on ASPHostDirectory.com .NET MVC Hosting?

We know that finding a cheap, reliable web host is not a simple task so we’ve put all the information you need in one place to help you make your decision. At ASPHostDirectory, we pride ourselves in our commitment to our customers and want to make sure they have all the details they need before making that big decision.

We will work tirelessly to provide a refreshing and friendly level of customer service. We believe in creativity, innovation, and a competitive spirit in all that we do. We are sound, honest company who feels that business is more than just the bottom line. We consider every business opportunity a chance to engage and interact with our customers and our community. Neither our clients nor our employees are a commodity. They are part of our family.

The followings are the top 10 reasons you should trust your online business and hosting needs to us:

- FREE domain for Life - ASPHostDirectory gives you your own free domain name for life with our Professional Hosting Plan and 3 free domains with any of Reseller Hosting Plan! There’s no need to panic about renewing your domain as ASPHostDirectory will automatically do this for you to ensure you never lose the all important identity of your site
- 99,9% Uptime Guarantee - ASPHostDirectory promises it’s customers 99.9% network uptime! We are so concerned about uptime that we set up our own company to monitor people’s uptime for them called ASPHostDirectory Uptime
- 24/7-based Support - We never fall asleep and we run a service that is opening 24/7 a year. Even everyone is on holiday during Easter or Christmast/New Year, we are always behind our desk serving our customers
- Customer Tailored Support - if you compare our hosting plans to others you will see that we are offering a much better deal in every aspect; performance, disk quotas, bandwidth allocation, databases, security, control panel features, e-mail services, real-time stats, and service
- Money Back Guarantee - ASPHostDirectory offers a ‘no questions asked’ money back guarantee with all our plans for any cancellations made within the first 30 days of ordering. Our cancellation policy is very simple - if you cancel your account within 30 days of first signing up we will provide you with a full refund
- Experts in .Net MVC Hosting
- Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up ASPHostDirectory
- Daily Backup Service - We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it
- Easy Site Administration - With our powerful control panel, you can always administer most of your site features easily without even needing to contact for our Support Team. Additionally, you can also install more than 100 FREE applications directly via our Control  Panel in 1 minute!

Happy Hosting!