ASP.NET 4.5 and ASP.NET Core 1 Hosting BLOG

Tutorial and Articles about ASP.NET 4.0 and the latest ASP.NET 4.5 Hosting

Visual Studio Hosting :: Configuration and Environment Variables in Visual Studio 2010

clock November 27, 2013 05:33 by author Mike

Environment variables are a great thing for when you publish your website to multiple places. It doesn't matter if you publish it to testing / staging / production environment or if you're publishing your site to several servers which require different methods to be called / different values assigned to parameters.

Let's create a web application project:

1. Open Visual Studio 2010
2. Create New Project -> ASP.NET Web Application

As you can see, you automatically have two configuration options:
- Debug
- Release

3. Right click on the project in the Solution Explorer. Click on Properties and click on Build tab.

4. Under that tab you have many configuration options. The field we're interested in is "Conditional compilation symbols". While on Debug mode, we will write a variable name in this field. Example: "vDebug"

5. After saving, you will have an identifier for when in Debug mode.
6. Before testing our work, we're gonna create another Configuration. Click on the configuration drop down list and choose Configuration Manager
.

7. Add new Configuration - TestRelease:

 

8. Now place the variables in Release Configuration and in TestRelease Configuration. I've placed the variables: vRelease and vTestRelease
9. Now for the test. Create a similar code on your Default.aspx.cs page:

When you will run the code, you'll see that for each configuration option it will it the correct method.



Windows ASP.NET Hosting - Boosting Web Application Performance with Bundling and Minification

clock February 1, 2013 10:34 by author andy_yo

The performance of your web application has a great impact on the end user experience. If your web application is slow, obviously users are going to be turned away from using it. There are many factors that contribute to the performance of a web site. A couple of important ones are - the number of requests sent from the browser to the server and the response size of each request. The newly added optimization features of ASP.NET 4.5 provide a neat way to bundle and minify JavaScript and CSS files thus taking care of the issues mentioned earlier. This article shows how these bundling and minification features of ASP.NET can be utilized in your web application.

About ASPHostPortal.com

ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, ASP.NET 4.5, ASP.NET MVC 4.0, Silverlight 5 and Visual Studio Lightswitch. Click here for more information

What is Bundling and Minification

Consider an ASP.NET MVC web application that consists of a view named Index.aspx and makes use of the following JavaScript files:

  • jquery-1.6.2.js
  • jquery-ui-1.8.11.js
  • modernizr-2.0.6-development-only.js

By default these files are located in the Scripts folder and you refer them in your views as follows:

  1. <script src="../../Scripts/jquery-1.6.2.js"></script>
  2. <script src="../../Scripts/jquery-ui-1.8.11.js"></script>
  3. <script src="../../Scripts/modernizr-2.0.6-development-only.js"></script>

Now, when the view is loaded in the browser, the browser makes three independent requests to the respective files. If you observe the requests using Chrome Developer Tools you will see something like this:

Notice a couple of things:

  • The browser has sent three separate requests to respective .js files.
  • The total response size will be the sum of the file sizes of the individual files.

Also, notice the time taken to download these files.

The overall performance of the view can be improved if you bundle all three requests as a single request. This way instead of making three separate requests the browser will send a single request and still download the content of all three files. Performance will be further improved if you minimize the size of each file being downloaded by minification techniques such as removing white spaces and comments.

Default Bundling and Minification

Luckily, ASP.NET 4.5 provides inbuilt support for bundling and minification of files. The core functionality of bundling and minification is found in System.Web.Optimization namespace. If you create a new ASP.NET project you will find the following line of code in the Global.aspx file:

  1. protected void Application_Start()
  2. {
  3. ...
  4. BundleTable.Bundles.RegisterTemplateBundles();
  5. }

As you can see, the Application_Start event handler contains a call to the RegisterTemplateBundles() method that does the default bundling and minification for you. For default bundling and minification to work you need to specify the URLs of the JavaScript and CSS files a bit differently.

  1. <script src="../../Scripts/js"></script>

Notice the above <script> tag carefully. Instead of specifying a <script> tag per file there is only one <script> tag and the src attribute is of the form <script_folder_path>/js. This naming convention tells ASP.NET that all the *.js files from the Scripts folder are to be bundled together and minified. If you observe the request in Chrome Developer Tools you will find just a single entry for JavaScript files like this:

Notice the size of the downloaded content and compare it with the combined size of individual files.

For CSS files you would have used <css_folder_path>/css in the <link> tag.

  1. <link rel="stylesheet" type="text/css" href="../../Content/css" />

Though the syntax shown above works as expected, there is a small drawback. Let's say you refer JavaScript and CSS files in your views using the above syntax and your web application starts serving the requests. Sometime later you update some of these JavaScript and CSS files. Naturally, you expect the new script and styles to come into effect. However, the earlier files might have been cached by the browser or proxy server. Since the URL to the files is the same (src="../../Scripts/js" and href="../../Content/css") there is no way for the browser to detect whether the files have been changed or not. To rectify the problem it is advisable to use the following syntax :

  1. <script src="<%= BundleTable.Bundles.ResolveBundleUrl("~/Scripts/js") %>"></script>
  2. <script src="<%= BundleTable.Bundles.ResolveBundleUrl("~/Content/css") %>"></script>

The ResolveBundleUrl() method accepts the virtual path of the folder containing the script or CSS files. The ResolveBundleUrl() method not only generates a URL for src and href attributes but also appends a unique string token in the query string. This token is changed when a file changes, thus ensuring a unique URL for the changed files. The following figure shows how the string token is added in the query string:

Customizing Bundling and Minification

At times the default bundling mechanism may not meet your requirements. For example, you might have ten JavaScript files in a folder but depending on the usage pattern you may want to bundle them in two separate bundles of five files each rather than a single bundle. Also, you may want to bundle the files in a specific sequence based on their dependencies. Such a customization is possible through Bundle class. The following code added to the Application_Start event handler shows how the Bundle class can be used:

  1. protected void Application_Start()
  2. {
  3. ...
  4. var bundle = new Bundle("~/MyScripts");
  5. bundle.AddFile("~/Scripts/jquery-1.6.2.js");
  6. bundle.AddFile("~/Scripts/jquery-ui-1.8.11.js");
  7. bundle.AddFile("~/Scripts/modernizr-2.0.6-development-only.js");
  8. BundleTable.Bundles.Add(bundle);
  9. ...
  10. }

The above code creates a new bundle for virtual path ~/MyScripts. It then calls the AddFile() method to add specific script files. Finally, the newly created bundle is added to the Bundles collection. To refer the newly created bundle in views you will use the following syntax:

  1. <script
  2. src="<%= BundleTable.Bundles.ResolveBundleUrl("~/MyScripts")
  3. %>"></script>

In addition to creating a custom bundle as shown above you can also customize the overall bundling and minification process. To do so, you need to create a custom class that implements the IBundleTransform interface. You then need to implement the Process() method of the IBundleTransform interface and write a custom processing logic. The following code shows a simple implementation of the IBundleTransform interface that adds a copyright notice to the bundled content.

  1. public class MyBundleTransform:IBundleTransform
  2. {
  3. public void Process(BundleContext context, BundleResponse response)
  4. {
  5. StringBuilder sb = new StringBuilder();
  6. sb.AppendLine("// Copyright (C) 2012. All rights reserved.");
  7. sb.Append(response.Content);
  8. response.Content = sb.ToString();
  9. }
  10. }

The above code creates the  MyBundleTransform class, which implements the IBundleTransform interface. The Process() method receives two parameters viz. a BundleContext and BundleResponse. The Process() method then adds a copyright notice at the top of the bundled content and then reassigns the Content property. You can also get ahold of the individual files of a bundle using the response.Files property.

To use the MyBundleTransform class you modify the Application_Start event handler as follows:

  1. protected void Application_Start()
  2. {
  3. ...
  4. var bundle = new Bundle("~/MyScripts", new MyBundleTransform()); bundle.AddFile("~/Scripts/jquery-1.6.2.js");
  5. bundle.AddFile("~/Scripts/jquery-ui-1.8.11.js");
  6. bundle.AddFile("~/Scripts/modernizr-2.0.6-development-only.js");
  7. BundleTable.Bundles.Add(bundle);
  8. ...
  9. }

As you can see a new bundle has been created as before but this time an instance of the MyBundleTransform class is passed as the second parameter of the constructor. If you observe the resultant script in the Chrome Developer Tools, you will find the copyright line added at the top:

Summary

The newly added bundling and minification features of ASP.NET 4.5 make it easy to bundle your JavaScript and CSS files thus boosting the overall performance of your web applications. In order to avail the bundling and minification features you need to specify URLs to script and CSS files in a certain way. Following this naming convention automatically bundles all of the JavaScript and CSS files from a folder and serves them as a single request. You can also customize the bundling process using the Bundle class and IBundleTransform interface.



DotNetNuke 7 Hosting - DotNetNuke 7 Key Features

clock January 22, 2013 08:04 by author andy_yo

DotNetNuke 7 provides support for active directory authentication and includes a SharePoint connector which enables fast and secure publishing of SharePoint documents to websites, intranets and extranets. It also includes a brand new intuitive control panel and now provides support for SharePoint Lists.

The DotNetNuke 7 professional and enterprise editions now ships with an auto save feature which provides the ability to automatically save the content in the background. This will enable users to recover the content in the event of a browser crash.

DotNetNuke 7 includes drag and drop modules, cross site module sharing, actions menu instead of manage button as in previous version, a new data access layer named DAL2 which includes micro-ORM and support for ASP.NET Razor in addition to a brand new simplified installer.

About ASPHostPortal.com

ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, ASP.NET 4.5, ASP.NET MVC 4.0, Silverlight 5 and Visual Studio Lightswitch. Click here for more information

The difference can DotNetNuke 7 make in the development of websites

There are a number of features that differentiate DotNetNuke 7.0 for website development which ultimately enable a broad range of users to be more productive:

Web content editors

A rich text editor with a new auto-save and recover feature prevents editors from losing their work. It also enables them to easily track content changes and compare versions of both rich text and HTML content. DNN 7.0 allows modules to be shared between multiple DotNetNuke websites for greater consistency and ease of maintenance.

Enterprises

DNN 7.0 makes it easier for enterprise users to log in to their DotNetNuke sites with new support for Active Directory authentication. It also now enables bi-directional support for popular Microsoft SharePoint Lists, which are used widely by businesses to improve operations, promote team project collaborations, keep employees up to date on current business projects and tasks, manage employees more effectively, and improve business productivity.

Developers

Web developers can build and expose secure web services through the DNN Services Framework, which is now based on Microsoft’s web API. Data access has been simplified through the introduction of a micro-ORM, allowing simpler and more elegant database interactions with less code.

ASP.NET Razor is now optimized for developing dynamic extensions, combining code and content in a fluid and expressive manner. The included jQuery, jQueryUI and Knockout.js libraries make it even easier for developers to consume Web services and create modern, interactive client-side applications.

The newest release has graduated to ASP.NET 4.0 as its baseline platform requirement but is also fully compatible with latest generation Microsoft technology including Windows 8, Windows Server 2012, IIS8, ASP.NET 4.5, Visual Studio 2012 and SQL Server 2012.

Designers

An overhauled Cascading Style Sheets (CSS) foundation makes it easier for designers to create beautiful and engaging websites, enabling improved cross-browser compatibility, extending standards compliance and increasing site performance. Additionally, DNN 7.0 includes standard form patterns that designers can reuse or extend to build frequently used user interface elements.

The DNN 7 different from previous versions

DotNetNuke 7.0 provides a revamped UI/UX that makes it easier for content editors to build and manage websites. It also provides a suite of new features that improve productivity through a drag and drop and an updated rich text editor that includes auto-save and version comparison features.

It  improves enterprise integration with an active directory authentication provider and by adding support for SharePoint List to our SharePoint Connector. This latest version provides our most advanced development framework with a web serves framework built on Microsoft's Web API.

The opportunity that DotNetNuke provide to ASP.NET developers

DotNetNuke provides a robust and powerful web development framework for ASP.NET developers. DNN7 provide support for the most recent versions of ASP.NET, and enable developers to embrace both Web Forms and WebAPI development methods.

The development framework greatly reduces the amount of code required to build applications by providing support for tasks like Security, Authentication, Installation and Upgrades. Developers can also distribute applications commercially on the DotNetNuke store where thousands of modules and skins are for sale.

The different of DotNetNuke with open source platforms like DotNetBlogEngine, Joomla and WordPress

DotNetNuke (DNN) is the most widely deployed content management platform and web development framework for Microsoft .NET. Organizations that have standardized on Microsoft technologies and have Microsoft development skills often prefer DNN over open source CMS offerings like Joomla and Wordpress which are built on the LAMP technology stack. These organizations also need a full featured Web CMS that provides features beyond blogging.

Can DotNetNuke run on MySQL backend?

DNN support Microsoft SQL Server out of the box. Third party providers for other databases are available and developers can create their own providers.



Visual Studio 2012 Hosting - Visual Studio 2012 and .NET 4.5 Features

clock January 22, 2013 06:27 by author andy_yo

New versions of Visual Studio usually coincide with updates to the .NET Framework, and this continues with the release of .NET 4.5 (.NET Framework 4.5). Here’s a quick review of what Visual Studio 2012 and .NET 4.5.

.NET Framework 4.5

The .NET Framework has exploded to include so many technologies (WCF, WPF, ASP.NET, etc.), features, and options. With .NET 4.5, there have been many updates to the core languages, with the asynchronous programming receiving lots of coverage.

If you plan to build Windows 8 applications, then you want .NET 4.5, because it has a subset called .NET for Windows Store. Building Windows 8 applications means you will be using HTML5 and CSS3, which are embraced by ASP.NET 4.5 and Visual Studio 2012. Web Sockets support has been added, as well as the ability to bundle JavaScript libraries/code and minimize the size of its download. ASP.NET Web Pages 2 provides more features for building pages on the fly, and improvements have been made to Web Forms and MVC. These features and more can be used to build powerful applications via the Visual Studio 2012 IDE. However, you can still target any version of the framework — that’s right, you are not forced to upgrade to .NET 4.5.

About ASPHostPortal.com

ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, ASP.NET 4.5, ASP.NET MVC 4.0, Silverlight 5 and Visual Studio Lightswitch. Click here for more information

The IDE

Figure A shows the welcome screen of Visual Studio Ultimate 2012 installation. Microsoft stated performance improvements are a key goal of Visual Studio 2012; this includes reducing the clutter of the developer’s workspace, which theoretically allows them to better focus on their work. The IDE now loads solutions asynchronously with key parts loaded first. Visual Studio 2012 does start up faster than Visual Studio 2010, but I’m not sure Microsoft succeeded in its goal to reduce clutter. The IDE opens with fewer windows like errors, classes, server explorer, and so forth, but these can easily be opened via the View menu, which was an option in previous versions of Visual Studio. There are indeed useful features that are designed to make things like previewing files without opening them easier.

Figure A


The Visual Studio Ultimate 2012 welcome page

Another interesting feature of Visual Studio 2012 is the inclusion of LightSwitch, Silverlight, and Expression Blend. The first two are project types within the IDE as shown in Figure B (among the many other project options). Expression Blend is installed as a separate application in the Visual Studio 2012 directory, but it is available only for Windows Store app development on Windows 8.

Figure B

Options for creating a new Web application in Visual Studio 2012

Figure C shows an ASP.NET Web Pages project opened in Visual Studio 2012. It is not a major shift from Visual Studio 2010, but you may notice the browser and DocType options just below the main menu. For this project, Google Chrome is selected as the target browser, but this drop-down list is populated with the browsers installed on the development machine so you can test with a variety of browsers. The DocType allows you to choose the target standard; HTML5 is the default for new projects, but you can target others depending on the project. In the IDE, you might also notice the menu options along the top — Website, Build, Debug, Team, SQL, Tools, and more; these options may change depending on the version of Visual Studio installed, but they do give a glimpse of the many things you can do within Visual Studio 2012.

Figure C

Working with an ASP.NET Web Pages 2 project within Visual Studio 2012

Integration with other Microsoft products

A key aspect of developing with Microsoft technologies is the tight integration with other Microsoft products. Visual Studio 2012 simplifies this by providing the environment to build applications that use these products. The following list provides a sampling of the possibilities:

PowerPoint: Use PowerPoint to begin the development process according to Agile methods with storyboarding (Microsoft has wholeheartedly embraced Agile). PowerPoint Storyboarding is a selection in the Visual Studio 2012 installation folder. In addition to PowerPoint, the complete Microsoft Office suite is available programmatically to use as needed in your code.

- Windows 8: Build applications for the new version of Windows.
- Windows Phone: Visual Studio 2012 allows you to target multiple platforms such as Windows Phone.
- SharePoint: Visual Studio 2012 allows you to build and test SharePoint applications.
- Team Foundation Server (TFS) 2012: Large scale projects require teamwork and source code control, both of which are readily provided in TFS 2012, which seamlessly integrates with Visual Studio 2012.
- System Center 2012: This can be used with TFS 2012 to automate the identification of production errors/bugs and to create tasks to fix these issues.

 



Visual Studio LightSwitch Hosting - Features and Benefits of Visual Studio LightSwitch

clock January 21, 2013 11:34 by author andy_yo

Visual Studio LightSwitch is Microsoft's flexible development tool used for building business applications. Visual Studio LightSwitch is a new member of the Visual Studio family. It is a stand alone application. According to Microsoft, Visual Studio LightSwitch is "the simplest way to create business applications for the desktop or the cloud". Visual Studio LightSwitch is a rapid application development (RAD) tool which is used to help write data-centric line of business (LOB) applications.

About ASPHostPortal.com

ASPHostPortal.com is Microsoft No #1 Recommended Windows and ASP.NET Spotlight Hosting Partner in United States. Microsoft presents this award to ASPHostPortal.com for ability to support the latest Microsoft and ASP.NET technology, such as: WebMatrix, WebDeploy, Visual Studio 2012, ASP.NET 4.5, ASP.NET MVC 4.0, Silverlight 5 and Visual Studio Lightswitch. Click here for more information

Feature Of LightSwitch

There are many features of LightSwitch. Visual Studio LightSwitch supports Windows Azure, SQL Azure, automatic data input validation etc. You can use the Visual Basic or Visual C# language in your LightSwitch application. The feature table of Lightswitch is shown below.

Benefits Of LightSwitch

There are many benefits of LightSwitch. The main benefits of LightSwitch are as follows:

  • Simplify development
  • Build a better application faster
  • Customize using extensions
  • Quickly add user-friendly features
  • Speed Deployment and Updates
  • Create a custom application for the way you do business
  • Build business applications like they were created by a professional designer
  • Easily add powerful authentication features
  • Evolve your application as business needs change

Simplify development

The nonrational Visual Studio LightSwitch 2011 development environment simplifies the development implementation and provides assistance when you need it. Lightswitch allows users to create applications with a modern multi-tier design that support both cloud and desktop clients, but with less coding, though you can add Visual Basic or C# code.

Build a better application faster

Visual Studio LightSwitch 2011 includes many screens for the most common types of business applications. It also contains predefined data types like date, datetime, phone numbers and e-mail addresses etc.

Customize using extensions

Using custom extensions like Picture and Text layout extensions you can present your data on screen. Custom extensions like  Money and Phone Number are also included in LightSwitch. Using the custom extensions you can change the appearance and behavior of your application.

Quickly add user-friendly features

Visual Studio LightSwitch 2011 have a user friendly feature i.e. export data to Ms-Office Excel for easy sharing and reporting. You can also create a table in Lightswitch from from SQL Server.

Speed Deployment and Updates

Using Visual Studio LightSwitch 2011, you can create one application that can be deployed to desktop clients and web clients. You can choose the best deployment method for deploy the LightSwitch application.

Create a custom application for the way you do business

Using Visual Studio LightSwitch you can create custom business application. In the Visual Studio LightSwitch you can apply custom validation or custom rules.

Build business applications like they were created by a professional designer

Visual Studio LightSwitch 2011 comes with an extensible set of pre-built Application Shells that can give your application the familiar feel of popular Microsoft software.

Easily add powerful authentication features

Visual Studio LightSwitch has an authentication feature. This feature is the most powerful feature of LightSwitch. The Authentication feature provides security to your LightSwitch application. In the Visual Studio LightSwitch you can generate many users with their authorization. Using the authentication feature of LightSwitch you can set user roles and permissions.

Evolve your application as business needs change

The pre-built screens and components in Visual Studio LightSwitch are fully extensible, so using additional features for your application is fast and easy.

Summary

So Visual Studio LightSwitch has many features and benefits. Visual Studio LightSwitch is used to build business applications.



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


 

Corporate Address (Location)

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

Tag cloud

Sign in