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

ASP.NET Hosting - ASPHostPortal.com :: How to Write Or Read Connection String From ASP.NET Web Config for DB driven Applications

clock October 9, 2015 07:00 by author Dan

This post explains How to Write Or Read Connection String From ASP.NET Web Config for DB driven Applications. We can either use connectionStrings section or AppSettings and can Write Programmatically At Run Time as well. Sql Server information is usually written inside <configuration>

<configuration>

<connectionStrings>  

<add name="MyCon"

  connectionString="Data Source=AMITJAIN\SQL;

  Initial Catalog=Northwind;User ID=amit;Password=password"

  providerName="System.Data.SqlClient" />  

</connectionStrings>

</configuration>


Where Data Source is db Server Address, Initial Catalog is DataBase Name. To use Windows Authentication instead of Sql Server Authentication write

  <connectionStrings>  

  <add name="MyCon"

  connectionString="Data Source=AMITJAIN\SQL;

  Initial Catalog=Northwind;Integrated Security=True"

  providerName="System.Data.SqlClient" />  

</connectionStrings>


For database attached in App_Data Folder we can write

<connectionStrings>  

  <add name="con"

  connectionString="Data Source=.\SQLEXPRESS;

  AttachDbFilename=|DataDirectory|\NORTHWND.MDF;

  Integrated Security=True;User Instance=True"

  providerName="System.Data.SqlClient" />  

</connectionStrings>


USING APPSETTINGS We can also write data in Key Value pairs.

  <configuration>

  <appSettings>

  <add key="con"

       value="Data Source=AMITJAIN\SQL;

              Initial Catalog=Northwind;

              User ID=amit;Password=password"/>

  </appSettings>

  </configuration>


READING WEB.CONFIG FILE PROGRAMMATICALLY
We can write code as mentioned below.

C# CODE
using System.Configuration;
string strConn = ConfigurationManager.ConnectionStrings["MyCon"].ConnectionString;

using System.Configuration;
string strConn = ConfigurationManager.AppSettings["con"].ToString();


VB.NET CODE
Imports System.Configuration
Dim strConn As String = ConfigurationManager.ConnectionStrings("MyCon").ConnectionString
Dim strConn As String = ConfigurationManager.AppSettings("con").ToString()

Best ASP.NET 4.6 Hosting Recommendation

ASPHostPortal.com provides its customers with Plesk Panel, one of the most popular and stable control panels for Windows hosting, as free. You could also see the latest .NET framework, a crazy amount of functionality as well as Large disk space, bandwidth, MSSQL databases and more. All those give people the convenience to build up a powerful site in Windows server. ASPHostPortal.com offers ASP.NET hosting starts from $1/month only. They also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable ASP.NET Hosting, ASPHostPortal.com should be your best choice.



ASP.NET 4.5 Hosting - ASPHostPortal.com :: How to use OnClick and OnClientClick events to Prevent Double Clicking on your ASP.Net Buttons

clock December 9, 2014 04:46 by author Dan

While ASP.NET gives a great validator set of controls, now and then you have to "move your own" so to talk when making your controls. What's more, on the off chance that you have some AJAX preparing with your buttons in the background (for instance, sparing a record in a popup window) you run the danger of having "twofold spares" happening when the client clicks on the button and nothing happens instantly.

Having battled with this issue myself recently, it took somewhat more work than expected to get this to work legitimately. Here's the manner by which you get everything to play pleasantly together.

The first step is to wire up your code behind occasion that does your handling. In case you're doing this in C# you setup your Onclick occasion:

<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />

In case you're doing this in Vb.net, there's no compelling reason to utilize the Onclick value as a part of your button, you can go straight to the code behind, make your strategy name, and utilize the Handles pivotal word, pointing out your buttons click occasion:

Protected Void Sub btnSave_Click Handles btnSave.Click
' Code here
End Sub

The next step is to do our validation using Javascript (we’re using jQuery in here).

function validatePage()
{
    var check = true;

    // Check only simple textbox for now
    if ($("#txtImportant").val() == '') check = false;

    if (!check)
    {
       alert('Missing data. Please complete');
       return false;
    }
    else
    {
       $("#MainContent_btnSave").val('Processing...');
       $("#MainContent_btnSave").attr("disabled", true);
       return true;
    }
}

There are several vital notes to this capacity. The main is not to overlook that Asp.net as a matter of course likes to help particularly name your server controls, subsequently the "Maincontent_" prefix on our spare button. You can utilize the Clientidmode property in the event that you have to get around this. The following is that we keep the client from twofold clicking the spare catch by handicapping the catch and transforming its content to say "Handling… " Finally, we just debilitate the button if the acceptance succeeds. This keeps us from needing to handicap and re-empower the button focused around the results. Strangely it likewise verifies that our return value in the HTML component forms accurately, which was likely one of the greatest glitches I ran crosswise over amid this process.

Presently we have to wire up the Javascript handling. To do this, we utilize the Onclientclick technique that is accessible for most .Net server controls. While taking a gander at our code above looks clear enough (return false to prematurely end the script or valid to proceed with the post back) we do need to change our rationale somewhat. Having a "return genuine" explanation doesn't let the button proceed with its post back, it will make it quit handling (very nearly the same as a return false summon). Rather, we let our rationale just prematurely end if our acceptance fizzled:

<asp:Button ID="btnSave" runat="server"
            Text="Save"
            OnClick="btnSave_Click"
            OnClientClick="if (!validatePage()) {return false;}" />

At long last, following we're overriding the HTML onclick occasion on the control (on account of the Oncilentclick property) that regardless of the possibility that your acceptance strategy succeeds, the code behind system won't shoot. To work around this, we utilize the Usesubmitbehavior property of the button control and set it to false. What this does is attaches the suitable __dopostback call after our Javascript code. The last code for your button resembles this:

<asp:Button ID="btnSave" runat="server"
            Text="Save"
            OnClick="btnSave_Click"
            OnClientClick="if (!validatePage()) {return false;}"
            UseSubmitBehavior="false" />

That is all there is to it. Presently when you click on the button, if the acceptance falls flat, you'll get the caution box. Something else, the button will get to be crippled with a "handling" message and your code behind strategy will run.



ASP.NET 4.5 Hosting - ASPHostPortal.com :: Uploading Several Data files Employing jQuery and Generic Handler in ASP.NET 4.5

clock December 5, 2014 09:11 by author Ben

This post describes the best way to upload numerous data files in ASP.NET Kinds using the jQuery and Generic Handler. Generally builders utilize the FileUpload Server management to add data files from the client device for the server that's rendered as as an Enter factor and set to file and helps you to pick out the file or various information. We can easily make use of the jQuery to help make an Ajax connect with towards the server and Submit the many picked documents for the Generic Handler as opposed to an entire webpage postback.

 


On this short article for creating the application, I am utilizing Visual Studio 2013 that has the framework 4.5.1. So, let us start with all the following course of action.

Creating WebForms

Step 1: Open Visual Studio and create the ASP.NET Web Application.

Step 2: Select the WebForms project template to proceed.

Visual Studio automatically creates the project and adds files and folders to the project by default.

Creating WebForm


Step 1: Just right-click on the project and add a new folder named "UploadedFiles".


Step 2: Just right-click on the project and add a new Web Form and replace the body content from the following content:

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

    <h2>ASP.NET</h2>
    <p class="lead">Selcting Multiple Files using jQuery and Generic Handler</p>  

 

    <div class="form-group">
        <div>
            <asp:Label runat="server" AssociatedControlID="MultipleFilesUpload">Select Files</asp:Label>           
            <asp:FileUpload ID="MultipleFilesUpload" runat="server" AllowMultiple="true" />          

        </div>
    </div>
    <div class="form-group">
        <div class="col-md-offset-2 col-md-10">
            <asp:Button runat="server" ID="BtnUpload" Text="Upload Files" CssClass="btn btn-default" />
        </div>
    </div>  
 </form>


In the code above, I used the AllowMultiple property of FileUpload that is set to true. It is one of the HTML 5 features used in here.

Step 2: Now in the <head> section add the following code:

<script src="Scripts/jquery-1.10.2.js"></script>

<link href="Content/bootstrap.css" rel="stylesheet" />

<link href="Content/Site.css" rel="stylesheet" />

<script type="text/javascript">
    $(document).ready(function () {
        $("#BtnUpload").click(function (event) {
            var uploadfiles = $("#MultipleFilesUpload").get(0);
            var uploadedfiles = uploadfiles.files;
            var fromdata = new FormData();
            for (var i = 0; i < uploadedfiles.length; i++) {
                fromdata.append(uploadedfiles[i].name, uploadedfiles[i]);
            }
             var choice = {};
            choice.url = "UploadHandler.ashx";
            choice.type = "POST";
            choice.data = fromdata;
            choice.contentType = false;
            choice.processData = false;
            choice.success = function (result) { alert(result); };
            choice.error = function (err) { alert(err.statusText); };
            $.ajax(choice);
            event.preventDefault();
        });
    });
</script>

Via the code over, the data files are chosen inside the file upload handle working with the information residence of the DOM factor. the loop iterates by means of many of the information then calls the append() method of the FormData to incorporate the data files into the FormData item.

Now, the info is usually to be sent into the server. The £.ajax() is employed to transfer the information. The choice item supplies numerous options such as focus on URL and HTTP process. Now we have set the URL home on the GenericHandler file named UploadHandler.ashx . We now have established the contentType and processData home to phony with which the jQuery will not likely URL encode the info while sending into the server. The achievements and mistake properties are utilised to display the messages as a result of an warn.

Creating Generic Handler

Step 1: Add the Generic Handler by right-clicking on the project named UploadHandler.


Step 2: Modify the code with the following code:

namespace UploadMultipleFilesApp
{
    public class UploadHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            if (context.Request.Files.Count > 0)
            {
                HttpFileCollection SelectedFiles = context.Request.Files;
                for (int i = 0; i < SelectedFiles.Count; i++)
                {
                    HttpPostedFile PostedFile = SelectedFiles[i];
                    string FileName = context.Server.MapPath("~/UploadedFiles/" + PostedFile.FileName);
                    PostedFile.SaveAs(FileName);                   
                }
            }
            else
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write("Please Select Files");
            }
            context.Response.ContentType = "text/plain";
            context.Response.Write("Files Uploaded Successfully!!");
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}

In this article we will see which the information which might be posted to your server and will be accessed using the Ask for object. Each individual element in the HttpFileCollection is of type HttpPostedFile. FileName property is utilized to receive the file identify of posted file and return it and also the similar name id used to conserve the file.

Run WebForm

Now run the webform and choose the files as shown below that the files are selected.


After clicking on Upload Files, the message is generated.


Summary

This article explained the best way to choose numerous information and add them utilizing jQuery and Generic Handler in ASP.NET Web Forms. Joyful Coding and thanks for looking at.

 



ASP.NET 4.5 HOSTING - ASPHostPortal :: How to Implement a Simple Captcha in C# .NET

clock December 1, 2014 06:07 by author Mark

Implement a simple captcha in C# .NET

  • Create a page with name “Captcha.aspx
  • Place the following html code in body part of the page

IMG height="30" alt="" src=BuildCaptcha.aspx width="80">
asp:TextBox runat="Server" ID="txtCaptcha">
    <asp:Button runat="Server" ID="btnSubmit"
     OnClick="btnSubmit_Click"
       Text="Submit" />
     On “btnSubmit_Click” place the following code
         if (Page.IsValid && (txtCaptcha.Text.ToString() ==
         Session["RandomStr"].ToString()))
           {
             Response.Write("Code verification Successful");
           }
    else
{
  Response.Write( "Please enter info correctly");
}

  • Include the following code in “BuildCaptcha.aspx"

Bitmap objBMP = new Bitmap(60, 20);
Graphics objGraphics = Graphics.FromImage(objBMP);
objGraphics.Clear(Color.Wheat);
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
  //' Configure font to use for text
      Font objFont = new Font("Arial", 8, FontStyle.Italic);
      string randomStr = "";
      char[] myArray = new char[5];
      int x;
   //That is to create the random # and add it to our string
     Random autoRand = new Random();
     for (x = 0; x < 5; x++)
{
  myArray[x] = System.Convert.ToChar(autoRand.Next(65,90));
  randomStr += (myArray[x].ToString());
}
     //This is to add the string to session, to be compared later
       Session.Add("RandomStr", randomStr);
    //' Write out the text
       objGraphics.DrawString(randomStr, objFont, Brushes.Red, 3, 3);
    //' Set the content type and return the image
  Response.ContentType = "image/GIF";
objBMP.Save(Response.OutputStream, ImageFormat.Gif);
objFont.Dispose();
objGraphics.Dispose();
objBMP.Dispose();

There you go you can test the page with captcha. Happy Programming Laughing



ASP.NET 4.5.1 Hosting with ASPHostPortal.com :: How to Increase The Overall Performance of ASP.NET 4.5.1 in your App

clock October 1, 2014 07:23 by author Ben

ASP.NET is really a framework for creating net applications created by Microsoft. Initially the technologies. NET is the successor of ASP which is also a computer software product from Microsoft. With .NET ASP gives a platform for developers to design and create dynamic websites and net portals.



You will find certain items that ought to be regarded as when improving the performance from the application in developing a net application. Here are a few of the tips to improve the performance of ASP.NET 4.5.1:

Turn off Session State
Disable session state if you do not need, as this can improve the all round efficiency. By default the session state is always active. However, you'll be able to disable session state for any specific pages.

Turn off Tracing
If tracing is enabled, tracing will add a whole lot of overhead in producing applications. Though tracing is actually a useful function inside the development because it enables developers to track and trace application sequence, tracing may be turned off, unless you want to monitor the trace logging.

Avoid Page Validation Server (Steer clear of Server-side Validation)
Within this case, must be attempted use of client-side validation, not the server side. Server-side validation will consume a lot of sources around the server which can have an effect on application efficiency.

Stay away from Exceptions (Avoid Exceptions)
Exceptions may be 1 of the biggest resource eater which resulted within the lower of web applications and windows applications. Therefore, it is much better to prevent the use and handling of exceptions which can be not beneficial.

Avoid frequent connections for the database (Steer clear of Frequent Calls to Database)
Connections are frequently made for the database can devote time response and resources (resources). This can be avoided by utilizing batch processing. Producing the minimum database connection as a connection is opened and not closed, may cause efficiency slowdown.

Stay away from utilizing Recursive Functions and Nested Loops
To improve application performance, attempt to always steer clear of utilizing nested loops and recursive functions simply because these functions consume a whole lot of memory.

Turn off the View State

In ASP.NET, the default view state will probably be active and will slow down the website. So if you don't use a kind postback, it's much better to disable view state.

Use Caching
Web page caching could be employed to get a particular period of time and towards the required duration will not visit the server and are served from the cache. In the case of static internet pages and dynamic, Partial Caching [Fragment Caching] may be utilized to break into a couple of pages a user control.



ASP.NET 4.5.2 Hosting with ASPHostPortal :: How to Publish and Deploy an ASP.NET Application in IIS

clock September 16, 2014 12:08 by author Kenny

Simple Way to Publish and Deploy an ASP.NET Application in IIS

ASP.NET is an open source server-side Web application framework designed for Web development to produce dynamic Web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. While Internet Information Services (IIS, formerly Internet Information Server) is an extensible web server created by Microsoft for use with Windows NT family. IIS supports HTTP, HTTPS, FTP, FTPS, SMTP and NNTP.

In this post, we will describe you how to publish and deploy your ASP.NET application in IIS. Actually it is so simple thing, you can publish your web application to the File System and copy paste all the files to your server. After that, you can add a new website from IIS. If you are not sure what files you should include, it's better to choose 'All files in the project' from the Package/Publish Web. Otherwise choose 'Only files needed to run this application'. You can set this by right clicking on the web application in the solution explorer and choosing 'Package/Publish Settings'.

Right click on your project in the solution explorer and choose 'Publish'. From the dialog box, as the publish method, choose 'File System'. And choose some directory as the Target Location.

You can add the website by right clicking on the 'Sites' in IIS.

Then give a name to your site and select the Physical path from where you copied the site folder

Best and Cheap ASP.NET Hosting

Are you looking for best and cheap ASP.NET Hosting? Look no further, ASPHostPortal.com is your ASP.NET hosting home! Start your ASP.NET hosting with only $1.00/month. All of our .NET hosting plan comes with 30 days money back guarantee, so you can try our service with no risk. Why wait longer?



ASP.NET 4.5.2 Hosting with ASPHostPortal.com :: SEO Tips for Your ASP.NET Site

clock August 23, 2014 09:42 by author Kenny

Here are 7 tips on SEO for your ASP.NET website:

A Microsoft server-side Web technology. ASP.NET takes an object-oriented programming approach to Web page execution. Every element in an ASP.NET page is treated as an object and run on the server. An ASP.NET page gets compiled into an intermediate language by a .NET Common Language Runtime-compliant compiler.

Page Titles

Page titles between tags is one important thing that many fail to practice in SEO. When a search is made in Google, these titles show up as links in the result. So that explains its importance. The common mistake among website owners is giving the same title for all pages. Page titles drive traffic to your site, hence it is important to have a proper title to attract visitors. Adding titles is not as hard as you imagine. If you have a product catalog use your product name as title. You can also choose to give a different title that is related to your product.

Meaningful URL

URLs that are long with query parameters do not look neat and it is difficult for the visitor to remember. Instead use formatted URLs for your static pages. URL which has a meaning explains the content in your website. Although experts agree with using an URL that has query parameters, it is better to have a meaningful URL. Components like UrlRewritingNet can be used for this purpose. Mapping support in URL is offered by IIS7 which has plenty of features.

Structure of the Content

Content without a structure is not possible.  You will have titles, headings, sub headings, paragraphs and others. How would you emphasize some quotes or important points in your content? If you follow the below mentioned steps, the structure of your content will be semantically correct.

  • Divide long stories or parts using headings. Short paragraphs make more sense to the readers. Use tags to bring beauty to your content.
  • If you want to emphasize an important point or quote, place them between tags.

Visitors can create structured content if you use FCKEditor and the like. Integrating these to your website is not complex.

Clean the Source Code

Don’t panic, it is advisable to clean up the source code and minimize the number of codes. The following simple steps will assist you in cleaning the source code: You can use

  • External stylesheets and not inline CSS
    • js files instead of inline JavaScript
  • HTML comments is not encouraged
  • Avoid massive line breaking
  • Avoid using viewstate when not required

The relation between the content and the code (JavaScript, HTML, CSS) determines the ranking of your website. Smaller source codes help build a strong relation.

Crawlable Site

Do not use

  • Silver or flash light for menus or to highlight information
  • Menus based on JavaScript
  • Menus based on buttons
  • Intro-pages

Do use

  • Simple tags wherever possible
  • Sitemap
  • “Alt” for images
  • RSS

Test the Site

What happens to the requests that are sent when the site is slow? Sometimes requests are sent by robots and if they are unable to connect to your site continuously, they drop the site from their index. Enable your site to respond fast to requests even during peak hours. Moreover, visitors don’t like to visit slow sites. Use the various tools available and conduct the stress test for your site. Perform this and locate all the weak parts of the site. Fix them so that your site gets indexed. 

Test the AJAX site

Spiders can only run a few parts of your AJAX website because they don’t run JavaScripts. Spiders can only analyze the data and hence they remain invisible to robots. The AJAX sites do not get indexed which does not help in search engine optimization. To make the site spider friendly, try and keep away from initial content loading into the JavaScript. You can also follow this only for pages that you like to index.  Make it easy for robots so that they can navigate. Try this simple trick to see how your AJAX site will appear to the robots. Disable JavaScript from the browser and visit your AJAX site. You can view the pages which robots will index.



Cheap ASP.NET Web Pages 3.2 Hosting :: New Features on ASP.NET Web Pages 3.2

clock July 22, 2014 13:01 by author Ben

Windows and ASP.NET hosting specialist, ASPHostPortal.com, has announced the availability of new hosting plans that are optimized for the latest update of the Microsoft Web Pages technology. The Web Pages 3.2,  introduces many new features including several that focus on premium media experiences and business application development.

ASP.NET Web Pages is a framework that you can use to create dynamic web pages. A simple HTML web page is static; its content is determined by the fixed HTML markup that's in the page. Dynamic pages like those you create with ASP.NET Web Pages let you create the page content on the fly, by using code.

The latest ASP.NET Web Pages 3.2  package has the following version: “3.2.0”. You can install or update these packages through NuGet. The release also includes corresponding localized packages on NuGet.

You can install or update to the released NuGet packages by using the NuGet Package Manager Console:

Install-Package Microsoft.AspNet.WebPages -Version 3.2.0

Nuget has many packages for ASP.NET Web Pages, such as:

ASP.NET Web Helpers Library
This package contains web helpers to easily add functionality to your site such as Captcha validation, Twitter profile and search boxes, Gravatars, Video, Bing search, site analytics or themes. This package is not compatible with ASP.NET MVC.

Microsoft WebPages OAuth library
This package contains the runtime assemblies for ASP.NET Web Pages. ASP.NET Web Pages and the new Razor syntax provide a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content.

Microsoft ASP.NET Razor

This package contains the runtime assemblies for ASP.NET Web Pages. ASP.NET Web Pages and the new Razor syntax provide a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content.

The  Advantages of ASP.NET WebPages 3.2 are :

- Framework to build dynamic web pages, typically suited for small-scale applications.
- Web pages can be developed using WebMatrix, a free tool from Microsoft which integrates web page editor, database utilities, integration with different browsers, local
- Uses Razor view engine, which is intelligent enough to understand the difference between server-side code and HTML code.


About ASPHostPortal.com:

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



Cheap Node.JS Hosting :: How to Solve Error Handling Callback in Node.JS

clock July 17, 2014 12:09 by author Ben

Error handling can be a drag, but it’s essential for the stability of your app. Naturally, I’m interested in ways to streamline the error handling process to make it as stable as it can be for the app whilst also being convenient for me to write. The async callback standard in Node.js suggests that the first parameter of the callback is an error object. If that's null, you can move along. If it's not, or you have an error thrown elsewhere, you have to figure out what to do. Let's take a look at our options!

Callback can carry on assuming the operation succeeded. Otherwise, it can deal with the error in an appropriate way, such as logging it along with any contextual information. It can then decide whether or not to carry on depending on the severity of the error or whether or not the resultant data is required to continue operation.

Let’s implement some error handling for our query error:

var log = console.log;
// We misspell 'SELECT' in this query so it fails
var query = 'SLECT 1 + 1';
con.query(query, function(err){
  if (err) return log("Query failed. Error: %s. Query: %s", err, query);
});

Our favourite library for asynchronous flow control is async. Both async.parallel and async.series accept a collection of operations, and if any of them pass an error to its callback, async will immediately invoke your completion callback with the error:

var async = require('async');
var log = console.log;
var op1 = function(cb) {
  // We misspell 'SELECT' in this query so it fails
  var query = 'SLECT 1 + 1';
  con.query(query, cb);
}

var op2 = function(cb) {
  // This query is fine
  con.query('SELECT 1 + 1', cb);
}

var ops = [op1, op2];

async.parallel(ops, function(err, results) {
  if (err) return log("Something went wrong in one of our ops. Err: %s", err);

  // Otherwise, process results
});


async.parallel will execute both op1 and op2 in parallel but if either or both fail it will invoke our completion callback with the error that occurred first.

Standard callbacks are all well and good when we’re following Node’s convention, but it’s a little bit laborious to check the result of every operation, and this can quickly get messy when there are many nested callbacks each with their own error handling code.


Best, Fast, and Reliable Node.js Web Hosting with ASPHostPortal.com

Business Ready Technology Solutions
We understand that IT isn’t a one-size-fits-all scenario. That’s why all of our enterprise hardware, software and cloud-based technology solutions can be customized to fit the needs of your business, while being flexible enough to grow as you grow.

Reliability - 99.9% uptime
That is the promise we make to you. Our proprietary software and expert system administrators monitor our servers 24 hours a day, 7 days a week.

Highly Secured
We are independent, and have our own infrastructure. Every application runs on HTTPS protocol by default.



Cheap WebSocket Hosting Tutorial :: How to Enable or Disable WebSocket Protocol on Windows Server 2012 and Windows 8

clock July 15, 2014 08:32 by author Ben

Websocket implements the server side of the WebSocket protocol. The WebSocket protocol is a protocol introduced in HTML5, intended to replace Comet and other long-polling solutions, to provide a rich communication mechanism over HTTP. The WebSocket protocol was standardized by IETF as RFC 6455. We could find introductions and more information on Wikipedia and W3C.

Microsoft .NET 4.5 provides several ways in using WebSocket. On the server side, we can host our WebSocket server through any one of the ways below:

  • Using HttpContext.AcceptWebSocketRequest
  • Creating a WCF service with CallbackContract and the new netHttpBinding
  • Using WebSocketHandler or WebSocketHost provided in Microsoft.WebSockets.dll


Here is the step by step how to enable WebSocket Protocol on Windows
Server 2012 and Windows 8 on server side:

NOTE: The web server must be IIS 8 and above.


Enable WebSocket Protocol in Windows Server 2012


On Windows Server 2012, you could do that through Server Manager -> Manage -> Add Roles and Features. -> Expand the Web Server (IIS) role and check Web Server -> Application Development -> WebSocket Protocol.


Enable WebSocket Protocol in Windows 8


Open "Control Panel" -> Open "Turn Windows features on or off" -> Expand Internet Information Services” -> Expand World Wide Web Services” -> ExpandApplication Development Features" -> Checklist WebSocket Protocol and clickOK


Disable WebSocket when using socket.io on node.js


If you are using the WebSocket support in socket.io on node.js in your site, you will need to disable the default IIS WebSockets module by adding the below snippet to your web.config or applicationHost.config. If this is not done, the IIS WebSockets module will attempt to handle the WebSocket communication rather than letting this task fall through to node.js (and hence your application). This will result in unexpected errors when you attempt to access your site.

<system.webServer>
    ...
    <webSocket enabled=”false”/>
</system.webServer>


Reasons to Trust Your ASP.NET 4.5 Websockets Hosting to ASPHostPortal.com

Uptime & Support Guarantees
We are so confident in our hosting services we will not only provide you with a 30 days money back guarantee, but also we give you a 99.9% uptime guarantee.
   
A Powerful User-Friendly Control Panel
Our Control Panel provides the tools and utilities, which give you true control over your account and web pages.

Setup Installation
We'll get you up and running within 30 seconds of placing your order.



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