Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

Tutorial and Articles about Windows Hosting, SQL Hosting, MVC Hosting, and Silverlight Hosting

Windows Hosting - ASPHostPortal.com :: Web Services with ASP.NET

clock July 25, 2016 20:35 by author Armend

Web Services with ASP.NET

A Web Service is programmable application logic accessible via standard Web protocols. One of these Web protocols is the Simple Object Access Protocol (SOAP). SOAP is a W3C submitted note (as of May 2000) that uses standards based technologies (XML for data description and HTTP for transport) to encode and transmit application data.
Consumers of a Web Service do not need to know anything about the platform, object model, or programming language used to implement the service; they only need to understand how to send and receive SOAP messages (HTTP and XML).

 

Soap Message

A SOAP message consists of several elements, most notably an envelope. The envelope encapsulates the data transmitted within the SOAP message. Below is a simple SOAP message complete with HTTP headers:

<?xml version="1.0"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
               xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
               xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
               xmlns:xsd="http://www.w3.org/1999/XMLSchema">
  <soap:Body>
    <PerfCounters xmlns="http://tempuri.org/"/>
  </soap:Body>
</soap:Envelope>

In the example above, we see the HTTP headers for the request, including the HTTP SOAPAction header, which is optionally used by the server for routing the SOAP message. Following the HTTP headers we find the body of the HTTP message. The body of the HTTP message is the SOAP request for a PerfCounters Web Service, which we are going to build.

Best Windows Server 2008 Hosting Recommendation

ASPHostPortal.com

ASPHostPortal.com provides our 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 2008. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2008 Hosting, we should be your best choice.

 



ASP.NET Hosting - ASPHostPortal.com :: How To Configuring your .NET application to use the ASP.NET Session State Store Provider

clock June 27, 2016 19:55 by author Armend

How To Configuring your .NET application to use the ASP.NET Session State Store Provider

In this post I will show you how to configure the ASP.NET session state store provider, you must update the web.config file for the ASP.NET application to include the ASP.NET session state store provider and its configuration.

Before you begin

  • Configure a data grid to store ASP.NET HTTP session state.
  • You must have the catalog server host and port.

Procedure

Update the web.config file of your ASP.NET application with settings for the ASP.NET session state store provider. You must update or add the text in bold in the following example to the web.config file

<system.web>
    …
    <sessionState
        mode="Custom"
        customProvider="WxsSessionStateStoreProvider">
        <providers>
                <add
                     name="WxsSessionStateStoreProvider"
                    type="IBM.WebSphere.Caching.SessionStateStore.WxsSessionStateStore,
                        IBM.WebSphere.Caching, Version=8.6.0.2000, Culture=neutral,
                        PublicKeyToken=b439a24ee43b0816"
                    wxsPropertyFile="\optional\path\to\NET-client.properties"
                    wxsHostAndPort="optionalHostAndPort"
                    wxsGridName="session"
                    wxsMapName="ASPNET.SessionState"
         />          
        </providers>
        </sessionState>
    …
</system.web>

wxsPropertyFile (optional)Specifies the fully qualified properties file that the provider uses when it connects to the data grid with the Connect API. If this attribute is not specified or is an empty string, the provider looks for the Client.Net.properties file in the current runtime directory of the web application process. If the provider does not find the file in the runtime directory, it looks for the Client.Net.properties file in the net_client_home\config directory.wxsHostAndPort (optional)Specifies a comma-separated list of catalog server host and port pairs to which the session state store provider connects when it accesses the data grid. The format follows:

<host name or host ip address>:<tcp port>[,<host name or host ip address>:<tcp port>]

If no value is specified, localhost:2809 is used.

wxsGridName (optional)

Specifies the name of the data grid to which the ASP.NET session store provider connects. If you created a data grid for ASP.NET session states, specify the data grid name that you created. If you do not specify a value, the provider connects to the session data grid.

wxsMapName (optional)

Specifies the map to which the provider connects. If you do not specify a value, the provider connects to the ASPNET.SessionState map.

  • Restart the target web application. The web application must restart so that the provider can be loaded by IIS. In most cases, after the web.config file is modified and current HTTP request processing is complete, the restart occurs automatically.

Results

ASP.NET session state from your ASP.NET application is stored in the data grid.



ASP.NET Hosting - ASPHostPortal.com :: How to Fix ASP.NET Browser Detection Error in Internet Explorer

clock June 20, 2016 20:50 by author Armend

Internet Explorer 11 has a bug which prevents ASP.NET applications from running properly. Your users will view broken layout and JavaScript errors, which occurs due to a bug in the browser detection under .NET Framework 4.

You can easily track down the browser detection problem by using F12 development tool available with Internet Explorer, which modifies the user-agent string sent by the browser. In order to work with the tool, you need to press F12, click the Emulation button located at the bottom left and choosing Internet Explorer 9 from the dropdown list. You will be able to see whether the page renders properly immediately after page refresh.

In order to fix the above issue, you need to install .NET Framework 4.5 on the server, which has built-in solution for this problem. However, if you are running Windows 2003 Server then you will have to install patches provided by Microsoft to update browser detection problem in older versions of .NET Framework. Alternatively, you can directly update the application by opening the App_Browsers folder and adding a .browser file with correct definitions as shown below.

<browsers>
  <browser id="IE11" parentID="Mozilla">
    <identification>
      <userAgent match="Trident/(?'layoutVersion'[7-9]|0*[1-9]\d+)(\.\d+)?;(.*;)?\s*rv:(?'version'(?'major'\d+)(\.

(?'minor'\d+)))" />
      <userAgent nonMatch="IEMobile" />
    </identification>
    <capture>
      <userAgent match="Trident/(?'layoutVersion'\d+)" />
    </capture>
    <capabilities>
      <capability name="browser"              value="IE" />
      <capability name="layoutEngine"         value="Trident" />
      <capability name="layoutEngineVersion"  value="${layoutVersion}" />
      <capability name="extra"                value="${extra}" />
      <capability name="isColor"              value="true" />
      <capability name="letters"              value="${letters}" />
      <capability name="majorversion"         value="${major}" />
      <capability name="minorversion"         value="${minor}" />
      <capability name="screenBitDepth"       value="8" />
      <capability name="type"                 value="IE${major}" />
      <capability name="version"              value="${version}" />
    </capabilities>
  </browser>
 
  <!-- Mozilla/5.0 (Windows NT 6.3; Trident/7.0; rv:11,0) like Gecko -->
  <browser id="IE110" parentID="IE11">
    <identification>
      <capability name="majorversion" match="11" />
    </identification>
 
    <capabilities>
      <capability name="ecmascriptversion"    value="3.0" />
      <capability name="jscriptversion"       value="5.6" />
      <capability name="javascript"           value="true" />
      <capability name="javascriptversion"    value="1.5" />
      <capability name="msdomversion"         value="${majorversion}.${minorversion}" />
      <capability name="w3cdomversion"        value="1.0" />
      <capability name="ExchangeOmaSupported" value="true" />
      <capability name="activexcontrols"      value="true" />

I hope this article helpful for you. happy coding :)

ASPHostPortal.com

ASPHostPortal.com provides quality and reliable ASP.NET 5 hosting services at affordable prices. We are guarantee 99.9% uptime for your site. We have three available payment methods: PayPal, Visa and American Express, so you can pay for their services from all around the world.



Windows Reseller Hosting - ASPHostPortal.com :: Best Practices windows cloud server security

clock April 27, 2016 20:57 by author Armend

More and more we are helping people get set up on  Windows cloud servers here at windows2008hosting.asphostportal.com .  While dedicated server solutions are the right choice for certain situations, clients are finding the benefits of cloud servers or, in many cases, a hybrid hosting solution to be the perfect fit for their hosting needs. With all this cloud talk, there are several technologies supported on Windows cloud servers that you may not have realized. These options can make the difference when configuring a cloud server solution that will best optimize your site or application.

 

Firewalls, VPN & SSL in the Cloud

The best practices of leveraging Virtual Private Networks (VPN), Secure Sockets Layers (SSL) and Firewalls to protect sensitive information on a Windows Cloud Server are recommend and also supported just as they would be with a physical dedicated server. If you’re unsure as to what any of these are and why they are necessary, the following will serve as a summary of each and their benefits.

What is VPN?

Virtual Private Networking is a secure and controlled method of connecting remote networks and users for the purpose of dealing with sensitive information. When using a VPN, all data is encrypted at the source, sent securely to the destination, then decrypted at the destination – assuring that only the previously approved source and destination people or systems can access the data. This is often a necessary element to incorporate in your hosting solution if you are an eCommerce company accessing sensitive back-end data like credit cards or orders, require PCI compliance, or simply need to securely work with remote clients or coworkers regarding sensitive information. A VPN connection allows you to guarantee identity through point-to-point connections and user authentication. While Windows cloud servers are virtual, they retain all the same VPN encrypting capabilities as a dedicated server, giving you complete control over security and privacy of your data. (For more information on Virtual Private Networking.

What is an SSL Connection?

The Secure Socket Layer protocol (SSL) ensures secure transactions between Windows cloud servers and browsers. This is particularly important anytime sensitive information must be transmitted over the open Internet. For example, any sign-up process where personal information is needed, (credit card information, personal data, etc.) would justify use of an SSL connection. You can recognize the use of an SSL connection when you see an “S” included in the URL (https://).
While the technical breakdown of an SSL can be somewhat complicated, it’s important to understand the basic concept of an SSL connection and how important it is inmaintaining security with sensitive information.

What is a Firewall?

A firewall is a security solution designed to only allow safe and trusted connections to whatever it is set to protect. It does this by identifying several pieces of information for all incoming connections, thus blocking access to any unfamiliar or unauthorized sources looking to access that data. The difference between a firewall and an SSL connection is that SSL is used to ensure your sensitive information can be securely sent from a webpage to a server, while a firewall is designed to control direct access to the cloud server itself. A firewall can be used to lock down ports and allow only certain information to be accessible, while keeping other information secure.

Firewall in a Windows Cloud Server

In order to set up a firewall in a Windows cloud server configuration, various steps must be taken to optimize the firewall for the cloud – but depending on your hosting provider, these steps will be covered for you. Once these steps are taken, it is no different than a firewall configured for a dedicated physical server.
Note: In addition to base intrusion detection and firewall protection offered at our network core, our Windows Cloud Servers come with free built-in Windows Firewall service that can be used to lock down ports and restrict access with a focus on the specific needs of your server – assuring that only the ports needed are opened and only available to the users or systems that need the sensitive access.

Cloud Server Security Best Practices

The above security steps are important in and of themselves, but they also serve as a baseline for achieving PCI Compliance, something in which we at ASPHostPortal.com are well versed. So, whether you’re looking to sure up your security as a best practice, or find yourself needing to implement the above steps in accordance with the PCI Security Standard Council, Windows cloud server hosting offers all the tools available on a dedicated server configuration, but often with several added benefits.

Best Windows Server 2008 Hosting Recommendation

ASPHostPortal.com

ASPHostPortal.com provides our 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 2008. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows server 2008 Hosting, we should be your best choice.



ASP.NET Hosting - ASPHostPortal.com :: How to Bind Data to a Label From a SqlDataSource

clock April 25, 2016 21:24 by author Dan

Label controls in ASP.NET don't have a smart tag that allows you to select a data source, so at first glance, it is not easy to see how to bind a value returned from a SqlDataSource or AccessDataSource control to the label. Here's how to programmatically access the data returned by such a DataSource and apply it to a non-databound control.

To programmatically access the contents of a SqlDataSource or AccessDataSource control you need to explicitly call its Select() method. This method accepts a single input parameter of type DataSourceSelectArguments. This parameter can contain information regarding the filters to apply or the column to Order By. For example, when working with a sortable GridView, sorting a column calls the Select() method, and passes in a DataSourceSelectArguments instance with its SortExpression property set to the column name the user chose to sort by. If you don't want the DataSource to sort or filter, you pass in DataSourceSelectArguments.Empty.

Depending on the DataSourceMode of the DataSource control, one of two objects are returned when the Select() method is called. If the DataSourceMode is set to DataReader, a DataReader object is returned. The type of DataReader (SqlDataReader, OleDbDataReader, OdbcDataReader etc) that is returned depends entirely on the provider type used - in other words, whether you are using the OleDb provider, SqlClient provider etc. It has nothing to do with the type of DataSource control. The examples below both query an Access database, but one uses the AccessDataSource control, and the other uses the SqlDataSource control. Both return OleDbDataReaders, because it is the OleDbProvider library that is used for the connection.

If the DataSourceMode is set to Dataset, or not set at all (which means that the default setting of Dataset is used) the object that is returned is a DataView. A DataView is like a DataTable on steroids. It exposes methods that allow you to filter and sort data, for example, and bind it. A DataView contains a collection of DataRowView objects, which represent each row in the returned results.

So, with a DataReader, you would access the values during the DataReader.Read() operation, in very much the same way as if you are using plain ADO.NET code, whereas with the DataSet, you would need to create an object of the appropriate type - DataView, then iterate the DataRowView collection to access the values. In this, the code is remarkably similar to accessing values directly from a DataSet's table collection using plain ADO.NET.

The code below shows the contents of an aspx file, which contains two label controls, and two SqlDataSource controls. Each SqlDataSource control has its DataSource mode set to alternative values - DataSet and DataReader, and both of them have an OnSelecting event defined in which the value of the EmployeeID parameter is assigned:

<asp:Label ID="Label1" runat="server" /> <asp:Label ID="Label2" runat="server" />

<asp:SqlDataSource
    ID="SqlDataSource1"
    runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
    DatasourceMode="DataSet"
    SelectCommand="SELECT [LastName], [FirstName] FROM [Employees] WHERE ([EmployeeID] = ?)"
    OnSelecting="SqlDataSource1_Selecting">
    <SelectParameters>
        <asp:Parameter Name="EmployeeID" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

<asp:SqlDataSource
    ID="SqlDataSource2"
    runat="server"
    ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
    DatasourceMode="DataReader"
    SelectCommand="SELECT [LastName], [FirstName] FROM [Employees] WHERE ([EmployeeID] = ?)"
    OnSelecting="SqlDataSource2_Selecting">
    <SelectParameters>
        <asp:Parameter Name="EmployeeID" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>


The following code snippet shows the aspx.cs file contents, where the parameter values are set in the Selecting event handler. In the Page_Load method, the data returned by each of the Sql DataSource controls is accessed and a value consigned to a label. The method of access depends on the DataSource mode, but is identical for both SqlDataSource and AccessDataSource:

[C#]
protected void Page_Load(object sender, EventArgs e)
{

    DataView dvSql = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
    foreach (DataRowView drvSql in dvSql)
    {
        Label1.Text = drvSql["FirstName"].ToString();
    }

    OleDbDataReader rdrSql = (OleDbDataReader)SqlDataSource2.Select(DataSourceSelectArguments.Empty);
    while (rdrSql.Read())
    {
        Label2.Text = rdrSql["LastName"].ToString();

    }
    rdrSql.Close();
}



protected void SqlDataSource1_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    e.Command.Parameters["EmployeeID"].Value = 2;
}

protected void SqlDataSource2_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
    e.Command.Parameters["EmployeeID"].Value = 2;
}

[VB]
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)

Dim dvSql As DataView =
    DirectCast(SqlDataSource1.Select(DataSourceSelectArguments.Empty), DataView)
    For Each drvSql As DataRowView In dvSql
        Label1.Text = drvSql("FirstName").ToString()
    Next

Dim rdrSql As OleDbDataReader =
    DirectCast(SqlDataSource2.Select(DataSourceSelectArguments.Empty), OleDbDataReader)
    While rdrSql.Read()

        Label2.Text = rdrSql("LastName").ToString()
    End While
    rdrSql.Close()
End Sub

Protected Sub SqlDataSource1_Selecting(ByVal sender As Object,
    ByVal e As SqlDataSourceSelectingEventArgs)
    e.Command.Parameters("EmployeeID").Value = 2
End Sub

Protected Sub SqlDataSource2_Selecting(ByVal sender As Object,
    ByVal e As SqlDataSourceSelectingEventArgs)
    e.Command.Parameters("EmployeeID").Value = 2
End Sub


When using this technique with Sql Server - or more specifically the SqlClient provider, change OleDbDataReader to SqlDataReader in the above code. Happy Coding.

Best Windows Shared Hosting Recommendation

ASPHostPortal.com provides our 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 Our Shared Hosting. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows Shared Hosting, we should be your best choice.



Windows Reseller Hosting - ASPHostPortal.com :: How to Choose Shared Web Hosting Service?

clock April 25, 2016 20:43 by author Armend

How to Choose Shared Web Hosting Service?

Shared web hosting is the most popular hosting solution for launching websites over the Internet. To help you pick a good option, we have introduced the most important aspects that should be considered when choosing web hosting service, including hosting features, customer service, cancellation policy, free marketing credits, and price. These are transparent checkpoints that you can evaluate a web host by yourself easily before signing up.

 

What Is Shared Web Hosting?

In order to have your business more visible for billions of internet users, you need to rent a web server which has fast connection to Internet and allows people to read your information. There are many options for hosting your websites. Usually the reasonable solutions are dedicated server, virtual private server, cloud hosting, and shared web hosting. If you're new to the internet or the estimated daily traffic of the website in the coming year is less than 800 page views or 300 unique visits, the shared web hosting shall be the best choice.

Shared web hosting means that the hosting company sells a dedicated server to thousands of customers. All of these customers share the server resources with each other. Each customer's data and files are protected to be invisible to others hosted with the shared server by some software or technology. Each customer has the complete access to the hosting account and shall be allocated with appropriate system resources.
What Is Shared Web Hosting The shared web hosting provider is responsible for the server maintenance, including both hardware and software.

  • Hardware: upgrade CPU, add memory, replace hard disk, setup backup system such as RAID 0/1/5, network routing and internet connection.
  • Software: upgrade OS or hosting solution software, install security patch, manage firewall, etc.

Meanwhile, as a customer, you have a web based control panel to manage your websites and services. You can view your website uptime or traffic statistics, exception logs, email accounts, and installation of applications. Most of companies don't help you maintain your website as the part of the hosting package unless you pay the additional money which may be more expensive than the hosting service itself.

Why Choose Shared Web Hosting?

Right Expectation on Customer Service For Shared Web Hosting Absolutely, it's the most budget and affordable web hosting solution that can promote your websites over the Internet. Generally, a good shared web hosting works flexibly for websites with less than 800 daily page views.
Another reason is that you don't need to take time maintaining the web server by yourself or hiring IT professionals. The hosting provider takes all of the work. Even some excellent providers perform data backups daily or weekly.

How to Choose Shared Web Hosting?

Pricing & Features

How to Choose Shared Web Hosting The reasonable price of shared web hosting is between $4 and $8 a month. This is the best range that well balances your cost and the web hosting service. It is suspected that some web hosts offer cheap web hosting under $3/month. In that case, it's highly possible that they cut off the customer service or oversell the server.
The best features of a web hosting are the things you require to launch your websites. So what you need to do is to create a list of features on what you need today and tomorrow, and check whether these are included by the hosting plan.

Reliability & Downtime Frequency

Reliability correlates to downtime. The downtime here doesn't mean 5 or 10 minutes down for server maintenance or scheduled operation. As I known, almost all web hosts have been hacked/attacked, down by hardware, or broken by OS/software upgrade. The key is the frequency and how they deal with the problem.
Right Expectation on Customer Service For Shared Web Hosting Basically, have one or twice downtime in a year is reasonable for web hosting in my opinion, not only shared web hosting, but also VPS hosting and dedicated server hosting. The reliability is determined by hardware, software and human maintenance.
As running a computer on hand, no one can guarantee there is no downtime caused by the damage of CPU, memory, motherboard or other hardware. How you can expect a server running for 24/7/365 with high working load without any problems.

Meanwhile, the system holes exist anywhere at all the time, so the hacks and attacks are endless. The FBI site had been hacked before, how you can think the web hosting is 100% secure perfectly.
What's more, most web hosts guarantee more than 99.9% uptime. To be frank, this number is extremely high. As we monitored dozens of web hosts , ASPHostPortal.com is the only host that completely provides such a reliable solution consistently. Read the uptime in the past 30 days below,



ASP.NET Hosting - ASPHostPortal.com :: How to Rank the Windows Hosting

clock April 19, 2016 20:01 by author Armend

How to Rank the Windows Hosting

To choose the really reliable Windows hosting, we follow the below guidelines.

#Operation System

The web hosting based on Windows server 2012 edition is ranked higher than the previous editions. Windows server 2012 has better performance, better stability, less consumption of system resources and high security. And it supports the best web server IIS 8.0 in Windows platform so far, which integrates with the ASP.NET pipeline much better than IIS 8.5/7.0

 

#Database System

ASP.NET applications work better with MSSQL than MySQL or PostgreSQL database. And the Windows web hosting supported MSSQL 2008 R2 gets a higher grade than MSSQL2005 and MSSQL2000. Feature and benefits in MSSQL2008 are better than the previous version of MSSQL, such as encrypt to enhance security, data compression to save disk space, parallel computing to accelerate speed, less consumption of system resource, and so on.

#DotNET Framework

The Windows hosting with support to multiple .NET framework versions especially .NET Framework V4 has a higher score in the ranking. The more versions supported the less compatible problems you may encounter, which also provides you more scalability to upgrade the websites later.

#Control Panel

Plesk is ranked as the No.1 control panel for Windows web hosting, and DotNETPanel, H-Sphere and other types have its advantage and disadvantage. We graded these types of control panels with different scores.

#Reliability

Reliability is the factor must be considered. It is evaluated by different criteria, we list these indicators below.

  • Uptime
  • Pre-install anti-virus software
  • Pre-install firewall
  • Network
  • Stable Datacenter

The best Windows web hosting listed above are ranked on these criteria, and all the 3 best windows web hosting truly meet the highest standards, which can powerful enough to run your website.

Pros and Cons of Windows Web Hosting

In fact, the Windows hosting solution is not as popular as the Linux hosting service. To give you a better understanding about this hosting type, we have listed some strong points and weak points of Windows web hosting.

The Strong Points

If your web host is a reliable and quality hosting provider, this hosting type can even achieve a more stable running than the normal Linux hosting solution.
It is surely multilingual that supports multiple scripting languages we have covered nowadays.
This hosting type is surely easy-to-use due to the immense popularity of Microsoft technologies. With it, there is no need to for you run the command line.
If you do not have enough experiences and knowledge of hosting, this type of hosting solution is arguably easier for you for the management tasks.

The Weak Points

Windows hosting is surely expensive. After all, the system of Windows is not free to use, but requires you to pay for the license fee. In addition, Windows can only be got from the official site or a few appointed agents, so there are almost no chances for you to get some lower charges or the attractive promotional campaign.
If you want to install some PHP based plugins, extensions and modules, the Windows hosting may fail to work well due to the compatibility issue.
Generally, PHP cannot work effectively with IIS as compared with Apache. For webmasters who are running a PHP based application, the 500 error might occur constantly.
Your web hosts may give you little flexibility for customizing and configuring your web servers.
If you want to use WordPress to set up and control your website, the Windows hosting service may fail to ensure you a good experience.



ASP.NET Hosting - ASPHostPortal.com :: How to solve page html getting wrongly appended to file being downloaded

clock April 18, 2016 21:24 by author Dan

Today while writing a small web application where I needed to download a datatable as csv file. I faced issue of page html getting wrongly appended to file being downloaded. I was using Response.Write to download file on client machine.

Solution to my problem was easy, I just needed to add an extra line telling content-length. Below is method that I finally ended up using.

        private void DownloadDataAsCsv(DataTable dt)
        {
            string tab = "";
            StringBuilder sb = new StringBuilder();
            foreach (DataColumn dc in dt.Columns)
            {
                sb.Append(tab + dc.ColumnName);
                tab = ",";
            }
            sb.Append("\n");
            int i;
            foreach (DataRow dr in dt.Rows)
            {
                tab = "";
                for (i = 0; i < dt.Columns.Count; i++)
                {
                    sb.Append(tab + dr[i].ToString());
                    tab = ",";
                }
                sb.Append("\n");
            }
            Response.ClearHeaders();
            Response.ClearContent();
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("content-disposition", "attachment; filename=Export.csv");
            Response.AddHeader("Content-Length", sb.ToString().Length.ToString());
            Response.Write(sb.ToString());
            Response.Flush();
            Response.End();
        }

Best Windows Shared Hosting Recommendation

ASPHostPortal.com provides our 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 Our Shared Hosting. We offers Windows hosting starts from $5/month only. We also guarantees 30 days money back and guarantee 99.9% uptime. If you need a reliable affordable Windows Shared Hosting, we should be your best choice.



ASP.NET MVC - ASPHostPortal.com :: Internet & Web How to Fix Only One <configSections> Element Error in Web.Config

clock April 11, 2016 19:44 by author Armend

In this article you will learn the solution to the common error "Only one <configSections> element allowed".
Today I was working on Entity Framework and trying to add the connection string to the Web.Config to specify the database. I wrote the connection string like this: 

  <?xml version="1.0" encoding="utf-8"?>     
    <configuration>   
       <connectionStrings>  
          <add name="SQLConnect"
               connectionString="Data Source=SAHIL; Initial Catalog=Demo; Integrated Security=SSPI"
               providerName="System.Data.SqlClient" />  
       </connectionStrings>    
       <configSections>  
          <sectionnamesectionname="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework,
              Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
       </configSections>    
       :  
       :  
       :  
       :  
       :  
       :  
       :  
    </configuration>

When I run the application, I experienced a strange error that says: "Only one <configSections> element allowed. It must be the first child element of the root <configuration> element".

It took me some time to determine the cause of the error and how to fix it.
Error: "Only one <configSections> element allowed. It must be the first child element of the root <configuration> element".

If you read the error carefully, it states that only one <configSections> element is allowed inside the Web.config and it should be the first child element and placed at the top. The reason for the error is that I accidentally placed the <connectionStrings></connectionStrings> at the top over the <configSections></configSections> and by conventions this is a violation. So, to fix the error, I rearranged the elements and the error was fixed.

<?xml version="1.0" encoding="utf-8"?>   
<configuration>  
   <configSections>  
      <sectionnamesectionname="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework,
       Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
   </configSections> 
   <connectionStrings>  
      <add name="SQLConnect"
           connectionString="Data Source=SAHIL; Initial Catalog=Demo; Integrated Security=SSPI"
           providerName="System.Data.SqlClient" />
   </connectionStrings>   
   :  
   :  
   :  
   :  
   :  
   :  
   :  
</configuration>

Conclusion

Your feedback and constructive criticism is always appreciated, keep it coming. Until then try to put a ding in the Universe. 



ASP.NET Hosting - ASPHostPortal.com :: Adding Facebook Share Functionality to an ASP.NET Website with a Master Page

clock April 4, 2016 23:13 by author Armend

This article assumes the reader has experience developing web sites using ASP.NET, specifically using Master Pages. It also assumes a familiarity with Facebook. All sample code is in C#. After reading this article, you should be able to integrate Facebook Share with an ASP.NET web site, whether or not it contains a Master Page. I've chosen to illustrate this using a Master Page because it's a little more involved, and once you can do it with a Master Page, you should be able to do it without one as well.

 

What is Facebook Share, and how does it work?

First, let's review what Facebook Share actually is. Adding a Share widget to a web page allows a user to click on an icon which launches a Facebook Share dialog. If the user has a Facebook account, they can then share the web page on their Facebook "wall" with their friends on Facebook, adding comments if they so choose. Their friends will have the opportunity to share with their friends, and so on. In this way, a web page's exposure can increase dramatically in a very short time.
According to the Facebook web site's documentation there are five steps you need to take in order to integrate Share with a web page:

Step 1: Add a link to the Facebook Share application hosted by Facebook:

<a name="fb_share" type="button" href="http://www.facebook.com/sharer.php">Share</a>

Step 2: Add a script tag that points to a Javascript component hosted by Facebook:

<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Step 3: Add a meta tag containing the title of the page:

<meta name="title" content="This is the Title" />

Step 4: Add a meta tag containing a description of the page:

<meta name="description" content="This is a short summary of the page." />

Step 5: Add a link tag pointing to an image to be used as a logo:

<link rel="image_src" href="http://www.murrayhilltech.com/images/LogoColorNoText.jpg" />

The Problem

All well and good, but we were talking about doing this while using a Master Page. See the problem yet? Well, if all the pages in our site use a common Master Page, which presumably contains the head tag, which in turn contains all the meta tags and link tags, how do we specify different tag values for different pages? Therein lies the problem. The solution lies in the code-behind file.

The Solution

I've chosen to place the code for Steps 1 and 2 in the actual web page as opposed to the Master Page, since that will allow us the flexibility to place the Share widget in varying locations on each page should we care to do so. However, I'm going to accomplish this by inserting an empty asp:Label component in the desired location in the aspx file, and assigning the appropriate value to it in the Page_Load event in the code-behind file. I'm going to use the same asp:Label component to hold the code for both Steps 1 and 2:

// This code for the asp:Label component goes in the aspx file
<asp:Label ID="labelSteps_1_2" runat="server" Text=""></asp:Label>
// The code to populate the asp:Label component with the html and script code
// for Steps 1 and 2 should go in the code-behind file
labelSteps_1_2.Text = "<a name=\"fb_share\" type=\"button\"></a>" +
"<script src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" " +
"type=\"text/javascript\"></script>";

Next, we'll instantiate a couple of HtmlMeta objects to handle the meta tags in Steps 3 and 4, also in the Page_Load event:

HtmlMeta tag = new HtmlMeta();
tag.Name = "title";
tag.Content = "This is the Title";
Page.Header.Controls.Add(tag);
HtmlMeta tag = new HtmlMeta();
tag.Name = "description";
tag.Content = "This is a short summary of the page.";
Page.Header.Controls.Add(tag);
Finally, we'll add the logo in Step 5 in the same Page_Load event using an HtmlLink object:
 HtmlLink link = new HtmlLink();
link.href="http://www.murrayhilltech.com/images/LogoColorNoText.jpg";
link.Attributes["rel"] = "image_src";
Page.Header.Controls.Add(link);

Creating these elements dynamically in the code-behind file allows us to add them to the head element of the Master Page without ever actually modifying the Master Page. You can use this same method for pages and/or sites that don't make use of Master Pages.

Putting It All Together

The complete listing for the code-behind file is shown below. The only other change we made was to add that asp:Label control to the aspx file. Here's the code behind file:

using System;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Net.Mail;
namespace MHT_Web_Site
{
public partial class MyPage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
labelSteps_1_2.Text = "<a name=\"fb_share\" type=\"button\"></a>" +
"<script " +
"src=\"http://static.ak.fbcdn.net/connect.php/js/FB.Share\" " +
"type=\"text/javascript\"></script>";
HtmlMeta tag = new HtmlMeta();
tag.Name = "title";
tag.Content = "This is the Title";
Page.Header.Controls.Add(tag);
HtmlMeta tag = new HtmlMeta();
tag.Name = "description";
tag.Content = "This is a short summary of the page.";
Page.Header.Controls.Add(tag);
HtmlLink link = new HtmlLink();
link.href="http://www.murrayhilltech.com/images/LogoColorNoText.jpg";
link.Attributes["rel"] = "image_src";
Page.Header.Controls.Add(link);
}
catch (Exception ex)
{
// Handle the exception
}
}
}
}

I hope that this article helps you get started integrating Facebook with ASP.NET web sites. For more information, check Facebook's web site. The documentation there is not organized very well, but it's there if you dig for it.

 



About ASPHostPortal.com

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

Sign in