Tag Archives: best and cheap asp.net hosting

ByAlexia Pamelov

How to Convert DataTable To JSON String in ASP.NET

CheapWindowsHosting.com | Best and cheap ASP.NET Hosting. First of all you need to create an “ASP.NET Empty Web Site”. Then use the following procedure.

Affiliate-program-01-1

Step 1

Create a ConvertDataTableToJson class in the App_Code folder and provide the following:

Convert DataTable To JSON String.       
    using System.Data 
    using System.Text; 
    public class ConvertDatatableToJson 
    { 
       public string DataTableToJson(DataTable dt) 
       { 
          DataSet ds = new DataSet(); 
          ds.Merge(dt); 
          StringBuilder JsonStr = new StringBuilder(); 
          if (ds != null && ds.Tables[0].Rows.Count > 0) 
          { 
             JsonStr.Append("["); 
             for (int i = 0; i < ds.Tables[0].Rows.Count; i++) 
             { 
                JsonStr.Append("{"); 
                for (int j = 0; j < ds.Tables[0].Columns.Count; j++) 
                { 
                   if (j < ds.Tables[0].Columns.Count - 1) 
                   { 
                      JsonStr.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\","); 
                   } 
                   else if (j == ds.Tables[0].Columns.Count - 1) 
                   { 
                      JsonStr.Append("\"" + ds.Tables[0].Columns[j].ColumnName.ToString() + "\":" + "\"" + ds.Tables[0].Rows[i][j].ToString() + "\""); 
                   } 
                } 
                if (i == ds.Tables[0].Rows.Count - 1) 
                { 
                   JsonStr.Append("}"); 
                } 
                else    
                { 
                   JsonStr.Append("},"); 
                } 
             } 
             JsonStr.Append("]"); 
             return JsonStr.ToString(); 
          } 
          else 
          { 
             return null; 
          } 
       }

Step 2

Insert the grid view control into the Default.aspx page then write the following design code:

<asp:GridView ID="ui_grdVw_EmployeeDetail" runat="server" Width="50%" AutoGenerateColumns="false" HeaderStyle-CssClass="pageheading"> 
    <Columns> 
    <asp:TemplateField HeaderText="S.NO"> 
    <ItemTemplate> 
    <%#Container.DataItemIndex+1 %> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee ID"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmployeeID" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_id") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee Name"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmployeeName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_Name") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Employee Post"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_EmpJob" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_job") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    <asp:TemplateField HeaderText="Department"> 
    <ItemTemplate> 
    <asp:Label ID="ui_lbl_Department" runat="server" Text='<%# DataBinder.Eval(Container.DataItem, "Emp_Dep") %>'></asp:Label> 
    </ItemTemplate> 
    </asp:TemplateField> 
    </Columns> 
    </asp:GridView> 
    <br /> 
    <asp:Button ID="ui_btn_Convert1" runat="server" Text="Manually Convert To Json" OnClick="ui_btn_Convert1_Click" /><br /><br /><br /> 
    <asp:Label ID="ui_lbl_JsonString1" runat="server"></asp:Label>

Step 3

Now, open the Deafult.asps.cs then write the following code:

using System; 
   using System.Data; 
   public partial class _Default : System.Web.UI.Page 
   { 
      #region Global Variable 
      DataTable dt; 
      ConvertDatatableToJson dtJ; 
      string JsonString = string.Empty;    
      #endregion 
       
      protected void Page_Load(object sender, EventArgs e) 
      { 
         if (!IsPostBack) 
         { 
            ui_grdvw_EmployeeDetail_Bind(); 
         } 
      }       
      protected void ui_grdvw_EmployeeDetail_Bind() 
      { 
         dt = new DataTable(); 
         EmployeeRecord employeeRecord = new EmployeeRecord(); 
         dt = employeeRecord.EmpRecord(); 
         ViewState["dt"] = dt; 
         ui_grdVw_EmployeeDetail.DataSource = dt; 
         ui_grdVw_EmployeeDetail.DataBind(); 
      }       
      protected void ui_btn_Convert1_Click(object sender, EventArgs e) 
      { 
         dtJ = new ConvertDatatableToJson(); 
         JsonString = dtJ.DataTableToJson((DataTable)ViewState["dt"]); 
         ui_lbl_JsonString1.Text = JsonString; 
      } 
   }

Step 4

Press F5, run the project.

Now, convert the DataTable to a JSON string using the newtonsoft DLL.

Step 1

Download the Newtonsoft DLL and move it to the ASP.Net project’s bin folder.

Step 2

Then, insert a button and label UI Control in the Deafult.aspx page as in the following:

<asp:Button ID="iu_btn_Convert2" runat="server" Text="Newtonsoft Convert To Json" OnClick="iu_btn_Convert2_Click" /> 
    <br /> 
    <br /> 
    <asp:Label ID="ui_lbl_JsonString2" runat="server"></asp:Label>

Step 3

Now, write the following code in Default.aspx.cs:
using this namespace

using Newtonsoft.Json;

 And then:

protected void iu_btn_Convert2_Click(object sender, EventArgs e) 
    { 
       dt = (DataTable)ViewState["dt"]; 
       JsonString = JsonConvert.SerializeObject((DataTable)ViewState["dt"]); 
       ui_lbl_JsonString2.Text = JsonString; 
    }

 Now, run the project and click on the Newtonsoft Convert to JSON .

Best OFFER Recommended ASP.NET Hosting ! Click Here

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – Tips You Shall Know on Choosing ASP.NET Hosting

CheapWindowsHosting.com | Best and cheap ASP.NET Hosting. Being devoted into ASP.NET development and ASP.NET website hosting for a couple of years, we know the secrets hidden in the ASP.NET hosting advertisement and how difficult to find a trusted and cost effective ASP.NET hosting provider. Thus, we would like to show you the top 10 tips on choosing ASP.NET hosting providers before starting with our topic.

  1. MS SQL Server database edition and limitation. The latest version of MSSQL 2012 are preferred.
  2. .NET Framework versions. Does it support the version used for your website?
  3. ASP.NET MVC versions. Does it support the version used for your website if you’re using ASP.NET MVC technology?
  4. Does it provide the dedicated application pool so that you won’t be affected by your neighbors?
  5. How long the IIS is set to recycle your website – usually 30 minutes at least is required.
  6. What’s the maximum dedicated memory allowed for the ASP.NET websites?
  7. The hosting provider needs to have the rich experiences and knowledge of how to ensure the high-quality ASP.NET hosting. Besides, it is great that they have got plenty of positive feedbacks from real customers and have been trusted and recommended by a lot of authorities, communities and hosting review sites.
  8. The ASP.NET hosting needs to ensure a high level of hosting reliability with at least 99.9% uptime. Note that this can be achieved with the utilization of cutting-edge data centers, solid server machines and no overselling practice. In addition, some confident web hosts even claim to give you some compensations if they fail to meet their promised uptime track record.
  9. The hosting speed is also pretty essential. After all, your readers can be frustrating if they find it takes a long time for accessing your website. In this case, you need to figure out that whether your web host can ensure the peak performance with no more than 3 seconds for page loading and 400 ms for the server response.
  10. The web host needs to ensure the all-time-rounded technical support to assist you 24 hours a day and 7 days a week. Also, their support staffs need to have the rich knowledge about ASP.NET hosting and related applications.

General Knowledge about ASP.NET

ASP.NET is the server-side online application framework coming with the open source nature. It is designed with the purpose of web development and dynamic webpages production mainly. In addition, developed by Microsoft, ASP.NET has been used by a lot of programmers for the creation of complicated websites, online applications and add-on services.

In fact, ASP.NET has been released since January 2002, which is the successor to the Active Server Pages technology of Microsoft. As it is built based on the Common Language Runtime, developers and programmers can write the ASP.NET code with the help of .NET language.

Cheap Windows ASP.NET Hosting

ASPHostPortal  Cheap Windows ASP.NET Hosting

Why we choose ASPHostPortal for the cheap ASP.NET hosting ?

ASPHostPortal.com, a Microsoft Golden hosting partner has been offering well priced Windows and ASP.NET hosting plans for many years. Founded in 2008 and operated in New York, US. ASPHostPortal.com has become an important resource for cutting-edge, high-value hosting solutions. The company also offers low priced enterprise-level hosting plans by focusing their resources on needs by ASP.NET Windows’s developers.

This company supports almost all the latest ASP.NET technology and provides plenty of server resources for every hosting account. Below are the list of key features, but definitely it provides more:

aspportalASPHostPortal.com | The cheap ASP.NET  Hosting Provider. Cheap and affordable Hosting features including:

ASPHostPortal.com


  1. Unlimited Sites, 5 GB Disk Space,  60 GB Bandwidth only $ 5.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. Compatible with nopCommerce, DNN, Magento and more other ASP.NET web applications.
  4. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

HostForLIFE  Affordable ASP.NET  Hosting

hflHostForLIFE.eu | Professional ASP.NET Provider & fully ASP.NET support. Customers can easily deploy the most popular ASP.NET, CMS & Blog system such as BlogEngine, DotNetNuke. The best ASP.NET hosting feature including :

HostForLIFE.eu


  1. Unlimited Domain, Unlimited Disk Space, Unlimited Bandwidth only €3.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

 UKWindowsHostASP.NET Best ASP.NET  Hosting

ukwinhostUKWindowsHostASP.NET | The best ASP.NET Provider & fully ASP.NET support. One of top and recommended ASP.NET Hosting Providers ! ASP.NET Hosting feature plan including:
 

  1. Unlimited Domains
  2. Dedicated Pool
  3. 99.99% Uptime Guarantee & 24/7 Live Support
  4. Support WordPress, Drupal and etc
  5. FREE Instant Setup
ByAlexia Pamelov

Cheap Windows ASP.NET Hosting Recommendation

CheapWindowsHosting.com | Best and Cheap ASP.NET Hosting. When you’re ready to take your data into your own hands and run your own blog, own your own photos, and host your own apps, it’s time to find a good web host that can put it all on the web for you, give you the tools, bandwidth, and storage you need, and support you when you need help. Thankfully, there are dozens of great companies looking for your business, and this week we’re going to look at three of the best, based on your nominations.

Are you looking for the cheap ASP.NET Hosting Comparison ?

Your Best Hosting search is over!

Do not Lose Money and Time and find the best Windows Hosting for you in our cheap ASP.NET Hosting Providers recommended list!

Cheap Windows ASP.NET  Hosting Comparison

ASPHostPortal  Cheap Windows ASP.NET Hosting

Why we choose ASPHostPortal for the cheap ASP.NET hosting ?

ASPHostPortal.com, a Microsoft Golden hosting partner has been offering well priced Windows and ASP.NET hosting plans for many years. Founded in 2008 and operated in New York, US. ASPHostPortal.com has become an important resource for cutting-edge, high-value hosting solutions. The company also offers low priced enterprise-level hosting plans by focusing their resources on needs by ASP.NET Windows’s developers.

This company supports almost all the latest ASP.NET technology and provides plenty of server resources for every hosting account. Below are the list of key features, but definitely it provides more:

aspportalASPHostPortal.com | The cheap ASP.NET  Hosting Provider. Cheap and affordable Hosting features including:

ASPHostPortal.com


  1. Unlimited Sites, 5 GB Disk Space,  60 GB Bandwidth only $ 5.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. Compatible with nopCommerce, DNN, Magento and more other ASP.NET web applications.
  4. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

HostForLIFE  Affordable ASP.NET  Hosting

hflHostForLIFE.eu | Professional ASP.NET Provider & fully ASP.NET support. Customers can easily deploy the most popular ASP.NET, CMS & Blog system such as BlogEngine, DotNetNuke. The best ASP.NET hosting feature including :

HostForLIFE.eu


  1. Unlimited Domain, Unlimited Disk Space, Unlimited Bandwidth only €3.00/Mo
  2. IIS 8.5 with URL-Rewrite, ASP.NET MVC Framework.
  3. 100% Satisfaction Promise with 30 Days Money Back Guarantee!

 UKWindowsHostASP.NET Best ASP.NET  Hosting

ukwinhostUKWindowsHostASP.NET | The best ASP.NET Provider & fully ASP.NET support. One of top and recommended ASP.NET Hosting Providers ! ASP.NET Hosting feature plan including:
 

  1. Unlimited Domains
  2. Dedicated Pool
  3. 99.99% Uptime Guarantee & 24/7 Live Support
  4. Support WordPress, Drupal and etc
  5. FREE Instant Setup

What makes them as the Cheap and Affordable ASP.NET  Hosting?

Trust Level

It’s the configuration in IIS for your websites. The best flexible option is Full Trust that you don’t worry the websites cannot run successfully in the shared web host. And the balanced option between security and flexibility is Medium if you’re experienced on joomla debugging, deployment and you’re sensitive on the security and server reliability.

Powerful Control panel

The control panel should be easy to configure asp.net stuff such as .net versions switch, trust level management and script map etc.

Database

They are consider more about the supported SQL Server version and limitation. The preferred SQL Server is 2008 however most of web hosts support Express edition only. Actually it’s completely enough for websites hosted with shared web hosting.

Customer support

No matter if you’re asp.net newbie or developer, you can’t avoid bothering the hosting support. 24 x 7 live support is always expected.

Save

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – Tips Increase Your ASP.NET Performance for SEO

CheapWindowsHosting.com | Best and cheap ASP.NET hosting. In this post we will explains you about Increase Your ASP.NET Performance for SEO. Lets check it out.

programmer vs artist

A challenge faced by web developers and designers is creating engaging, responsive, interactive web pages that load quickly and keep the user happy.  With high performance site, then our site will be ranked higher by Google. In this tutorial, I will show some tips how to increase your site performance in ASP.NET. The better ranking most likely lead to more click throughs, increasing the website’s visibility, audience, and profit.

Increasing ASP.NET performance for SEO

I have been using ASP.NET programming language for many years and I always learn how to increase my asp.net speed. With great ASP.NET performance, then it will increase our website visibility, audience, and profit. And google like the site with high performance. Here are few tips from me how to increase your ASP.NET performance:

1. Disable Session State

Disable Session State if you’re not going to use it.  By default it’s on. You can actually turn this off for specific pages, instead of for every page:

<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="WebApplication1.WebForm1"
EnableSessionState="false" %>

 

You can also disable it across the application in the web.config by setting the <sessionState> mode value to Off.

2. Avoid Server-Side Validation

Try to avoid server-side validation, use client-side instead. Server-Side will just consume valuable resources on your servers, and cause more chat back and forth.

3. Use HTTPServerUtility.Transfer instead of Response.Redirect

Redirect’s are also very chatty.  They should only be used when you are transferring people to another physical web server.  For any transfers within your server, use .transfer!  You will save a lot of needless HTTP requests.

4. Turn off Tracing

Tracing is awesome, however have you remembered to turn it off? If not, make sure you edit your web.config and turn it off!  It will add a lot of overhead to your application that is not needed in a production environment.

<configuration>
<system.web>
<trace enabled="false" pageOutput="false" />
<trace enabled="false" requestLimit="10" pageOutput="false" traceMode="SortByTime" localOnly="true"/>
<compilation debug="false" />
</system.web>
</configuration>

5. Avoid Exceptions

Avoid throwing exceptions, and handling useless exceptions. Exceptions are probably one of the heaviest resource hogs and causes of slowdowns you will ever see in web applications, as well as windows applications.  Write your code so they don’t happen!  Don’t code by exception!

6. Turn Off ViewState

If you are not using form postback, turn off viewsate, by default, controls will turn on viewsate and slow your site.

public ShowOrdersTablePage()
{
this.Init += new EventHandler(Page_Init);
}

private void Page_Init(object sender, System.EventArgs e)
{
this.EnableViewState = false;
}

 

7. Use Paging

Take advantage of paging’s simplicity in .net. Only show small subsets of data at a time, allowing the page to load faster.  Just be careful when you mix in caching. How many times do you hit the page 2, or page 3 button?  Hardly ever right!  So don’t cache all the data in the grid! Think of it this way: How big would the first search result page be for “music” on Google if they cached all the pages from 1 to goggle

8. Use ControlState and not ViewState for Control

If you followed the last tip, you are probably freaking out at the though of your controls not working.  Simply use Control State. 

Conclusion

There are hundreds more where these came from, however I really feel that these are the most critical of the speed improvements you can make in ASP.net that will have a dramatic impact on the user experience of your application. If you find benefits on this article, please kindly share it!

Best OFFER Cheap ASP.NET 5 Hosting ! Click Here

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – Tips To Boost Your ASP.NET Performance

CheapWindowsHosting.com | Best and cheap ASP.NET hosting. In this post we will explain about how to boost your ASP.NET performance.

ASP.NET is a web application server framework that has been designed to make the process of website development easier , especially for the creation of dynamic web pages . It is important to understand the usefulness of ASP.NET applications in building efficient , robust and reliable .

businessman-with-a-computer_1012-166

Below are my top 7 tips to improving ASP.net application Performance :

1 . Use HTTPServerUtility.Transfer instead of Response.Redirect

Redirect ‘s are also very chatty . They should only be used when you are transferring people to another physical web server . For any transfers within your server , use . Transfer! You will save a lot of needless HTTP requests.

2 . Always check Page.IsValid when using Validator Controls

So you’ve dropped on some validator controls , and you think your good to go Because ASP.net does everything for you ! Right ? Wrong ! All that happens if bad the data is received is the IsValid flag is set to false . So the make sure you check Page.IsValid before processing your forms !

3 . Deploy with Release Build

Make sure you use the Release Build mode and not Debug Build when you deploy your site to production . If you think this does not matter , think again . By running in debug mode , you are creating PDB ‘s and cranking up the timeout . Deploy Release mode and you will see the speed improvements .

4 . Pre – Compiling ASP.NET Application

When compiling an ASP.NET application project , a single assembly is created to hold all the application ‘s code but the web pages ( . Aspx ) and user controls ( . Ascx ) not compiled and be deployed as it is . In the first request ASP.NET dynamically compiles the web pages and user control and places the compiled files in the ASP.NET temporary files folder .

To reduce the time of the first request a web application can be pre-compiled , Including all the code , pages , and user controls , by using the ASP.NET compilation tool ( Aspnet_compiler.exe ) . Running this tool in production servers can reduce the delay users experience on first requests .

  • Open a command prompt in your production server .
  • Navigate to the % windir % Microsoft.Net folder
  • Navigate to either the Framework or Framework64 According to the configuration of the web application ‘s application pool .
  • Navigate to the framework version ‘s folder .
  • Enter the following command to start the compilation

Aspnet_compiler.exe – v / FullPathOfYourWebApplication

5 . Disable Session State

Disable Session State if you’re not going to use it . By default it ‘s on . You can actually turn this off for specific pages, instead of for every page :

< % @ Page language = " c # " Codebehind = " WebForm1.aspx.cs "

AutoEventWireup = “false ” Inherits = ” WebApplication1.WebForm1 “

">EnableSessionState = "false " % >

mode value to Off. “>You can also disable it across the application in the web.config by setting the value to Off mode .

6 . Repeater Control Good, DataList, DataGrid, and DataView controls Bad

Asp.net is a great platform , unfortunately a lot of the controls that were developed are heavy in html , and create not the greatest scaleable html from a performance standpoint . ASP.net repeater control is awesome ! Use it ! You might write more code , but you will thank me in the long run !

7 . Create Per -Request Cache

Use HTTPContect.Items to add single page load to create a per – request caching.

Best ASP.NET Core 1.0 Hosting Recommendation

asphostportal-icon-e1421832425840-120x120-e1424663413602ASPHostPortal.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.

Simpan

Simpan

ByAlexia Pamelov

Cheap Windows ASP.NET Hosting – ASP.NET Content Management Systems

CheapWindowsHosting.com | Cheap and reliable ASP.NET hosting. A Content Management System makes it easy to manage your website content and design your own website. CMS allows you to manage every aspect of your website such as content, functionality and navigation, design, SEO and more. CMS enables you to easily create and update content without programming skills. The appearance of all content in CMS website is controlled by a set of templates that will make managing your website easier than you can imagine.

Cheap ASP.NET based Content Management Systems(CMS)

kenticoKentico CMS for ASP.NET – Kentico CMS is powerful ASP.NET based Content Management platform to build web sites and web applications. Kentico CMS utilizes ASP.NET and Microsoft SQL Server. It is full-featured CMS with e-commerce, intranet, social networking, online marketing tools, Ajax support, Mobile websites support, Sharepoint support, Supports Visual Studio .NET and ASP.NET, Ready-to-use website templates (Corporate Site, E-commerce Site) and more.

Kentico CMS hosting requires: Windows Server 2008,.NET Framework 3.5 SP1 or 4.0 or higher, IIS 7.0, 7.5, 8.0 , Microsoft SQL Server 2005, 2008, 2008 R2, 2012. If you want to edit source, you need Visual Studio/Visual Web Developer 2008/2010/2012.

DNN4DotNetNuke (DNN) 

DNN is the leading open source web content management platform. The Community Edition is open source. The functionality can be extensible through a large number of third-party modules.

MojoPortal CMS 

slide_mobilemojoPortal is an open source, cross-platform, content management system for ASP.NET which is written in the C# programming language. MojoPortal content management system requires ASP.NET 3.5 or ASP.NET 4.0/4.5, IIS 6 or higher, any of the following 5 Databases( MSSQL/SQLExpress/SQL-CE/SQL-Azure, MySql, PostgreSQl, Firebird Sql, and SQLite). Features includes Blogs, Forums, Calendar, Google/Bing Maps, Contact Form, Newsletter, Polls, Surveys, ecommerce & more. MojoPortal is an extensible and mobile friendly.

OrchardOrchard 

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform. Orchard content management system requires: Windows Server 2003 or Windows 2008 Server, ASP.NET 4 or above, IIS Express 8, 7.5 or IIS 7.x, Up to 12 GB ofhard drive space for a full Orchard installation, Full Trust mode for applications to perform better.

Umbraco 

cmsUmbraco is an open source content management system built on Microsoft’s .NET technology stack. It is simple, flexible and friendly. Umbraco content management system requires: IIS6+ (IIS 7 Preferred),SQL CE or SQL Server 2008 , ASP.NET 4, Medium-Trust/Full-Trust and ability to set file permissions to include create/read/write (or better) for the user that “owns” the Application Pool for your site.

sitefinity-logoSitefinity CMS

Sitefinity is a web content management and collaboration platform designed to help organizations pursue their online goals. Sitefinity content management system requires: Windows Server 2003/ 2008/2008 R2/2012, 32-bit or 64-bit operating system, IIS 6+, .NET Framework 4.0 and 4.5, ASP.NET MVC 4.

ASP.NET CMS Hosting features

  • You need a windows hosting package that meet full requirements of CMS software
  • Latest versions of NET Framework 4.0 / 4.5 / 5 or above
  • Supported database platforms (SQL Server 2008 or above)
  • Automated installation of CMS of your choice
  • Experienced customer support staff

Best and Recommended ASP.NET CMS Hosting:

ByAlexia Pamelov

Cheap Windows ASP.NET Tutorial – Tips Run external .NET Program from RAM Memory

CheapWindowsHosting.com | Run external app directly from RAM. You can load the specific file into a Byte [] Array with a StreamReader () or even download it from WEB via a direct link provided.

The point of this technique is to maintain anonymity to a fragile file, thus leaving no chance to a reverse engineer to crack the details.

Also note, to keep the variables such as the one referencing the MethodInfo() on a Class basis. You then should Dispose() or set to Nothing these variables at the FormClosing() Event to prevent memory leak.

programmer vs artist

Tips Run external .NET Program from RAM Memory

Dim method As System.Reflection.MethodInfo
Sub Run
        Dim bb() As Byte = IO.File.ReadAllBytes("file.exe")

        Try
            Dim a As System.Reflection.Assembly = System.Reflection.Assembly.Load(bb)

           'or a = Reflection.Assembly.Load(New WebClient().DownloadData("https://...."))
            method = a.EntryPoint
            If (Not method Is Nothing) Then

                Dim o As Object = a.CreateInstance(method.Name)
                method.Invoke(o, Nothing)

            'if your app receives parameters
            'method.Invoke(o, New Object() {New String(){"Hello}})
            Else
                Throw New NullReferenceException("method is null.")
            End If

        Catch ex As Exception
            MsgBox(ex.Message & vbCrLf & "File length: = " & bb.Length.ToString)
        End Try
End Sub

If your app is WinForms and not ConsoleApplication, then follow the steps below:

Your external application needs to start from a Main() Sub to be compatible with this. Otherwise, change the solution property of your external app:

  • Disable ApplicationFramework
  • Add new module to your project (Module1)
  • Select ‘STARTUP OBJECT’ Module1
  • Add this code to Module1
Public Sub Main()
     Application.Run(New Form1)
     'Form1 is your first WinForm that your app displays
End Sub

 or if your app receives parameters:

Public Sub Main(ByVal args As String())
     Application.Run(New Form1)
     'Form1 is your first WinForm that your app displays
End Sub

 I hope this post helpful for you :)

ByAlexia Pamelov

Cheap Windows ASP.NET Tutorial – Steps for Session InProc Mode to Session ASP.NET State Server

CheapWindowsHosting.com | Cheap and reliable ASP.NET State server. 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 the ability to support ASP.NET State server Service for session.

ahp new

Many articles are discussing about advantages of using Session StateServer or SQLServer over InProc Mode.  One basic reason why I choose StateServer Mode is when your website is running on Third Party Hosting than you will notice that Session Timeout can occur anytime depends on load of traffic on your server.

If your website has large number of visitors and session timeout can cause problem, It is better to change Session Mode Session=”InProc” to Session=”StateServer”.

Main Advantage of Session StateServer (Best to choose while hosting on third party server)

  • Session is persistent and reliable.
  • Avoid Session Timeout due to Memory shortage on server (IIS Setting).

Main Disadvantage

  • Poor Performance compare to Session=”InProc”
  • Session_End Event would not fire.

Now lets understand
Steps for changing Session InProc Mode to Session StateServer Mode.

Step 1:  Start Asp.net State Service

  1. Go to Control Panel > Administrative Tools > Services 
  2. Select Asp.Net State Service.
  3. Right Click on Asp.net State Service and choose start from popup menu.

service1

Start1

If you forget to Start Service you will receive following error.

Server Error in '/' Application.
Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either 'localhost' or '127.0.0.1' as the server name.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Unable to make the session state request to the session state server. Please ensure that the ASP.NET State service is started and that the client and server ports are the same.  If the server is on a remote machine, please ensure that it accepts remote requests by checking the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\aspnet_state\Parameters\AllowRemoteConnection.  If the server is on the local machine, and if the before mentioned registry value does not exist or is set to 0, then the state server connection string must use either ‘localhost’ or ‘127.0.0.1’ as the server name.

Step 2:  Change Session Mode in Web.Config File

sessionState mode="StateServer"
            stateConnectionString="tcpip=127.0.0.1:42424"
            cookieless="false"
            timeout="120"/>

Note: You can adjust timeout minutes based on your requirement.  Let the tcpip server to be localhost i.e. 127.0.0.1.  Most webhosting company uses these settings unless you have different IP for StateServer and  You are not required to change Port Number.

Step 3: Make All Object Serializable

You should make all object in your website to serializable.

Note: To take advantage of Session StateServer or SQLServer or Custom Mode, object needs to be serialized.

Example:  If your project contains class files for creating DAL (Data Access Layer), you should append Serializable to every class definition in order to make class Serializable.

Understanding Serialization in C#

Class Department

{
        long   _deptId;
        string _deptName;
        
        public long DeptId
        {
               get {   return _deptId; }
               set {  _deptId = value; }                  
         }

        public string DeptName
        {
               get {   return _deptName; }
               set {  _deptName = value; }                  
         }
}

IMPORTANT While doing Serialization
Remember SQLConnection cannot be serialized.
 
You might receive following error if you don’t handle this situation.

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Web.HttpException: Unable to serialize the session state. In ‘StateServer’ and ‘SQLServer’ mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in ‘Custom’ mode.

So to handle this situation you need to do following thing

  • Mark SQLConnection Object as NonSerialized
    NonSerialized] protected SqlConnection _mainConnection;
  • Mark your Class as Serializable and derive from IDeserializationCallback
    Example:
Class Department: IDeserializationCallback

{
        long   _deptId;
        string _deptName;
        
        public long DeptId
        {
               get {   return _deptId; }
               set {  _deptId = value; }                  
         }

        public string DeptName
        {
               get {   return _deptName; }
               set {  _deptName = value; }                  
         }

        //Create this Method Inside your Class
       void IDeserializationCallback.OnDeserialization(object sender)
        {
            //Recreate your connection here
            _mainConnection = new SqlConnection();
            _mainConnection.ConnectionString =
                    ConfigurationSettings.AppSettings["connStr"].ToString();           
        }
}

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

Simpan

Simpan

Simpan

ByAlexia Pamelov

Cheap Windows Hosting – Tips to make ASP.NET MVC application SEO friendly

CheapWindowsHosting.com |One of the big benefits of using an existing system such as WordPress or Magento, is many things simply come out of the box. One of these things is being “SEO – friendly”: being optimized for the search engines.

Note: While not all WordPress installations are perfect for SEO, it’s usually really good compared to custom installations.

aspnet-seoWhen you’re working in ASP.NET MVC, chances are you’re dealing with a custom solution. That is great; it just means we have to do a lot of things on our own. In this post I will go through the most important elements. However, SEO changes all the time and we don’t really know what triggers Google – so it’s worth continuing your research afterwards to find out if there are things that are forgotten.

I decided to split the changes into “Required”, “Important” and “Nice to have”. What category I placed them in is a bit random and based on my own experiences and what I’ve read – but use it more as a general guideline.

Required on-site SEO optimisations for ASP.NET sites

Make site is indexable

This has less to do with ASP.NET MVC than it has to do with JavaScript frameworks such as Angular. While there is a lot of discussion about whether Google reads these JavaScript MVC sites correctly or not, there is an important point to make:

All your content should be served from the server at the point of load. Yes, it’s nice to load it dynamically using a JavaScript framework or jQuery call, but that can and will hurt SEO. Make sure to always load it when you serve the view from the controller.

Note: If you Google “Angular SEO friendly” you will get plenty of methods on how to do this in practice.

Unique title tags for each view

One of the most important ranking factors is the <title> tag in the header. Make sure to set a unique one for each view in your application – also small pages such as contact and about.

For dynamic pages this is the most important, as you would often have your main content there.

Important on-site SEO optimisations for ASP.NET sites

Sitemap in ASP.NET MVC

Sitemaps are important to tell the search engines exactly what pages you have. Unfortunately you have to make them yourself.

  • For smaller sites, it’s quite simple. Either you do it manually (which works if you don’t have any dynamic content) or automatically (more on that in a second). You simply make a controller called Sitemap, and makes sure your site responds to calls such as /sitemap and /sitemap.xml .
  • For bigger sites it’s challenge. If you have a million pages which a previous customer of ours did, you need to run an underlying console job that generates the sitemap.
  • To help you build it there are a couple of Github projects to help you, and here is an example:
    https://github.com/maartenba/MvcSiteMapProvider

Only one <h1> on each page

Each page, when fully rendered, should only have a <h1> tag. The <h1> tag is what the page is about, and should be the main headline.

Canonical URL on pages

It’s in general a very good idea to put a canonical URL on most views. The idea is you tell Google what the real version of the URL is.

A typical example is you have the same page that gets indexed with unique query strings:

  • ?tracking=qwerty
  • ?ref=query

The idea is you then make a canonical URL and refer to itself. So if your view is placed on http://domain.com/page, and you have a version such as http://domain.com/page?ref=query, you should have a canonical URL that is http://domain.com/page.

Remove /home/ from URL in ASP.NET MVC

In a lot of ASP.NET MVC projects, many pages end up having a /home/ url. An example could be /home/contact. The shorter and more clear URLs, the better. And this is just a quick small thing to update inside the route file.

Prev and next on paginated listings

When you have a paginated result, it’s worth implementing the “prev” and “next”. It’s a way of telling the search engines you are on a paginated result, and what the next and previous pages are.