European ASP.NET 4.5 Hosting BLOG

BLOG about ASP.NET 4, ASP.NET 4.5 Hosting and Its Technology - Dedicated to European Windows Hosting Customer

ASP.NET 4.5.2 Hosting - HostForLIFE.eu :: How to Fix : HTTP Error 500.19 - Internal Server Error

clock September 22, 2014 07:53 by author Peter

Some time ago I moved my ASP.NET 4.5.2 site to the Windows Server with IIS (Internet Information Service). Right after installation I got the following error:

HTTP Error 500.19 - Internal Server Error
The requested page cannot be accessed because the related configuration data for the page is invalid.

Solution

1. First, Open IIS Manager, select root node( the hosting server)
2. In the middle panel double click Feature Delegation.
3. In right panel select "Custom Site Delegation... " In upper part of middle panel
4. click the drop down list and select your site.
5. In Action panel click Reset All Delegation.



ASP.NET 4.5.2 Hosting Italy - HostForLIFE.eu :: How to CasCading DropDownList using Generic Handler & JQuery in ASP.NET ?

clock September 17, 2014 08:09 by author Peter

Sometimes we need to do fill DropDownList using JQuery & Generic Handler in ASP.NET 4.5.2. You can see this in the example below:

Design Page:
<asp:DropDownList ID=”ddlState” runat=”server” OnPreRender=”ddlState_PreRender”
CssClass=”choose_dropdown”>
<asp:ListItem Value=”0″>SELECT YOUR STATE</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID=”ddlProduct” runat=”server”
CssClass=”choose_dropdown”>
</asp:DropDownList>

Generic Handler:
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = “application/json”;
int id = Convert.ToInt32(context.Request["id"]);
string sJSON = GetProduct(id);
context.Response.Write(sJSON);
}
public string GetProduct(int id)
{
ProductController objPrductCont = new ProductController();//My Class Name
//GetProductsByStateID(id) = It will Give All Record On The Basis Of ID
List<ProductInfo> objProduct = objPrductCont.GetProductsByStateID(id);
//Converting Object into JSON
System.Web.Script.Serialization.JavaScriptSerializer oSerializer =
new System.Web.Script.Serialization.JavaScriptSerializer();
string sJSON = oSerializer.Serialize(objProduct);
return sJSON;
}


JQuery Script:
$(“select[id$=ddlState]“).change(function () {
var statVal = $(“select[id$=ddlState]“).val();
if (statVal != “SELECT YOUR STATE”) {
var id = statVal = $(“select[id$=ddlState]“).val();// You will get the value of selected item
$.post(“/CallHandler.ashx”, { id: id }, function (result) {
$(“select[id$=ddlProduct]“).empty();
$(“select[id$=ddlProduct]“).removeAttr(“disabled”);
$(“select[id$=ddlProduct]“).attr(“style”, “cursor:default”);
$(“select[id$=ddlProduct]“).append($(“<option></option>”).val(0).html(“SELECT YOUR PRODUCT”));
$(result).each(function (i) {
$(“select[id$=ddlProduct]“).append($(“<option></option>”).val(result[i].Id).html(result[i].ProductName));
});
});
}
else {
$(“select[id$=ddlProduct]“).empty();
$(“select[id$=ddlProduct]“).append($(“<option></option>”).val(0).html(“SELECT YOUR PRODUCT”));
$(“select[id$=ddlProduct]“).attr(“disabled”, “disabled”);
return false;
}
});



European HostForLIFE.eu Proudly Launches Joomla 3.3 Hosting

clock September 16, 2014 12:48 by author Peter

HostForLIFE.eu proudly launches the support of Joomla 3.3 on all our newest Windows Server environment. HostForLIFE.eu Joomla 3.3 Hosting plan starts from just as low as €3.00/month only. Joomla 3.3 Hosting continues the tradition set by the Joomla 3x series of getting great backward compatible releases out with awesome new features.

Joomla 3.3 Hosting brought about an exciting round of changes focusing on security, SEO, and improved stability. We'll be taking a look at the improvements to the CMS with this release and how it is arguably the most stable and secure release of the CMS.

Joomla 3.3 is truly a Something New for Everyone release, which standard-term support release and is a one-click upgrade (not a migration) from previous Joomla 2.5 and 3 series releases. Another wonderful feature of Joomla 3.3 is that Microdata library will be included in the Joomla 3.3 release. With help from the library, search engines will be your friends, not enemies anymore. Customer can enhance the web content with many useful data relating people, products, places, reviews, events etc.

HostForLIFE.eu is a popular online Joomla 3.3 hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market.

HostForLIFE.eu offers the latest Joomla 3.3 hosting installation to all HostForLIFE’s new and existing customers.  The costumer can simply deploy our Joomla 3.3 site via HostForLIFE.eu world-class Control Panel or conventional FTP tool. This framework is part of the service and it is provided free off charge. HostForLIFE.eu are happy to offering the most up to date Microsoft services and always had a great appreciation for the products that Microsoft offers.

HostForLIFE are committed to providing the latest technology and a service that is unbeatable. HostForLIFE.eu want to make sure that customers have our good opportunity to test this new technology. HostForLIFE customers can now take advantage of Joomla 3.3.

For more information about this new product, please visit http://hostforlife.eu/European-Joomla-33-Hosting

About Company
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. HostForLIFE.eu deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

 



ASP.NET 4.5.2 Germany - HostForLIFE.eu :: How to Solve Error: "Cannot start the website because administrative privileges are required to bind to the hostname or port"

clock September 9, 2014 06:54 by author Peter

Have you encountered the error “Binding failure error - "Cannot start the website because administrative privileges are required to bind to the host name or port" while starting to debug your ASP.NET web application?

PROBLEM
I had one simple web app, created with the MVC5 C# template, which worked all okay until few days. Suddenly, when try to start up I got a message "Cannot start the website because administrative privileges are required to bind to the host name or port" The project was created with Visual Studio 2013 before last update version 3. also I try tried to start project in Visual Studio 2012 and that was also unsuccessful.

SOLVING
1. Close your Visual Studio solution and go to your project’s folder and find the CSPROJ file.
2. Open it using your favorite text editor and find the following lines
3.  Search for these two lines and DELETE them:

<DevelopmentServerPort>0</DevelopmentServerPort>

<IISUrl>http://localhost:57680/</IISUrl>

4. Save CSPROJ file
5. Open your solution again and start debugging. You should now be able to debug your web application.

Let me know if this solution for the issue  “Binding failure error – Cannot start the website because administrative privileges are required to bind to the hostname or port” works for you.



European ASP.Net 4.5.1 Hosting Germany :: Assembly Binding Redirect Not Working

clock September 1, 2014 09:58 by author Onit

Assembly Binding Redirect is a .NET mechanism allowing developers whose application was compiled against a certain strongly-named assembly version to swap that assembly with a different version without recompiling the entire assembly. One of the methods for achieving this goal is by placing a special directive in the application’s configuration file.


.NET Ignoring Assembly Binding Redirect

An example of such a configuration section can be seen below:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" publicKeyToken="1234abcd1234abcd"
          culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Though it just a simple configuration section, it’s hard for me to fix it such a section which for some reason did not appear to be having any effect on the .NET runtime’s behavior. After quite some time using the Assembly Binding Log Viewer trying to identify the issue, I finally figured it out.

I Just Edited into like this:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="myAssembly" PublicKeyToken="1234abcd1234abcd"
          culture="neutral" />
        <bindingRedirect oldVersion="1.0.0.0" newVersion="1.1.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

Can you spot the difference? The “p” in “publicKeyToken” was accidentally written as a capital letter, resulting in no errors thrown by the .NET framework, but plenty of frustration for me seeing that the above section does not do anything.

Conclusion

The .NET framework configuration is intolerant of typos on the one hand (the configuration won’t work) but it doesn’t warn you about it either. If something doesn’t work for no apparent reason, this is definitely a possible reason.

This may be a simple problem but you may got yourself frustrated for only one little mistake such a typo. Just a few lines in my example, but if you had a hundred of lines you don’t even want to make any mistake. How tiny is that.

 

 



European HostForLIFE.eu Proudly Launches WordPress 4.0 Hosting

clock September 1, 2014 09:06 by author Peter

HostForLIFE.eu proudly launches the support of WordPress 4.0 on all our newest Windows Server environment. On WordPress 4.0 hosted by HostForLIFE.eu, you can try our new and improved features that deliver extremely high levels of uptime and continuous site availability start from €3.00/month.

WordPress is a flexible platform which helps to create your new websites with the CMS (content management system). There are lots of benefits in using the WordPress blogging platform like quick installation, self updating, open source platform, lots of plug-ins on the database and more options for website themes and the latest version is 4.0 with lots of awesome features.

WordPress 4.0 was released in August 2014, which introduces a brand new, completely updated admin design: further improvements to the editor scrolling experience, especially when it comes to the second column of boxes, better handling of small screens in the media library modals, A separate bulk selection mode for the media library grid view, visual tweaks to plugin details and customizer panels and Improvements to the installation language selector.

HostForLIFE.eu is a popular online WordPress 4.0 hosting service provider catering to those people who face such issues. The company has managed to build a strong client base in a very short period of time. It is known for offering ultra-fast, fully-managed and secured services in the competitive market.

Another wonderful feature of WordPress 4.0 is that it uses vector-based icons in the admin dashboard. This eliminates the need for pixel-based icons. With vector-based icons, the admin dashboard loads faster and the icons look sharper. No matter what device you use, whether it’s a smartphone, tablet, or a laptop computer, the icons actually scale to fit your screen.

WordPress 4.0 is a great platform to build your web presence with. HostForLIFE.eu can help customize any web software that company wishes to utilize. Further information and the full range of features WordPress 4.0 Hosting can be viewed here http://hostforlife.eu/European-WordPress-4-Hosting

About Company
HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.



Comparison of Windows ASP.NET Hosting between HostForLIFE.eu Hosting Platform and Windows Azure Platform

clock August 25, 2014 09:33 by author Peter

Given the length of this review and the number of plans, it is unrealistic to compare everything of them one by one. As usual, the review focuses on price, features, uptime & speed as well as customer support. Before starting our detailed comparison, we’d like to share with you the overall ratings of the plans based on our first-hand hosting experience and large-sampled customer reviews.

Please refer to this table for more differences and similarities.


HostForLIFe.EU

Windows Azure

 

 

 

Price

€3.00/month

$76 / month

Website

Unlimited

100

Disk Space

Unlimited

1 GB

Bandwidth

Unlimited

Unlimited

1 SQL Server Size

Include 50MB

0 to 100 MB = $ 5.041/mo

Server Features

Include 4 GB RAM or higher

768 MB = $16/month

SLA

99.90%

99.90%

ASP.NET 4.5.2 / ASP.NET 4.5.1

Yes

Yes

ASP.NET 4.5 / ASP.NET 4.0

Yes

Yes

ASP.NET 3.5 / ASP.NET 2.0 / ASP.NET 1.1

Yes

Yes

Classic ASP

Yes

Yes

ASP.NET MVC 6.0 / 5.2 / MVC 5.1.2 / MVC 5.1.1 / MVC 5.0

Yes

Yes

ASP.NET MVC 4.0 / MVC 3.0 / MVC 2.0

Yes

Yes

WordPress

Yes

Yes

Umbraco

Yes

Yes

Joomla

Yes

Yes

Drupal

Yes

Yes

Node.js

Yes

Yes

PHP 5

Yes

Yes

Conclusion
Both companies are able to provide brilliant Windows hosting service. If a choice has to be made, we recommend HostForLIFE.eu as your web host because the price is more reasonable, features more complete and the performance and our technical support are awesome.To learn more about HostForLIFE.eu web hosting, please visit http://www.hostforlife.eu



ASP.Net 4.5.1 Hosting UK :: Concurrent Queue in Thread Safe collections

clock August 18, 2014 07:42 by author Onit

What is Thread Safe Collection?

People use to said that writing a collection which is mutable, thread safe and usable is an extremely difficult process. Since the .NET 4 introduce the system.collection.concurrent namespace, multiple threads can safely and efficiently add or remove items from these collection without requiring additional synchronization in user code. When you write new code, use the concurrent collection classes whenever the collection will be writing to multiple threads concurrently and in this article I’ll going to show you about thread safe collection in Concurent Queue.

Concurent in .Net

Concurrent collections in .NET work very much like their single-thread counterparts with the difference that they are thread safe. These collections can be used in scenarios where you need to share a collection between Tasks. They are typed and use a lightweight synchronisation mechanism to ensure that they are safe and fast to use in parallel programming.

Concurrent queues

The Queue of T generic collection has a thread-safe counterpart called ConcurrentQueue. Important methods:

  1. Enqueue(T element): adds an item of type T to the collection
  2. TryPeek(out T): tries to retrieve the next element from the collection without removing it. The value is set to the out parameter if the method succeeds. Otherwise it returns false.
  3. TryDequeue(out T): tries to get the first element. It removes the item from the collection and sets the out parameter to the retrieved element. Otherwise the method returns false

The ‘try’ bit in the method names implies that your code needs to prepare for the event where the element could not be retrieved. If multiple threads retrieve elements from the same queue you cannot be sure what’s in there when a specific thread tries to read from it.

Example

Declare and fill a concurrent queue:

ConcurrentQueue<int> concurrentQueue = new ConcurrentQueue<int>(); 
for (int i = 0; i < 5000; i++)
{
    concurrentQueue.Enqueue(i);
}

We’ll want to get the items from this collection and check if all of them have been retrieved using a counter. The counter will also be shared among the threads using the ‘lock’ technique we saw in this post – or actually something that is similar to the ‘lock’ keyword: the Interlocked class. Interlocked has an Increment method which accepts a ref int parameter. It will increment the incoming integer in an atomic operation.

int itemCount = 0;
Task[] queueTasks = new Task[20];

for (int i = 0; i < queueTasks.Length; i++)
{
    queueTasks[i] = Task.Factory.StartNew(() =>
    {
        while (concurrentQueue.Count > 0)
        {
            int currentElement;
            bool success = concurrentQueue.TryDequeue(out currentElement);
            if (success)
            {
                Interlocked.Increment(ref itemCount);
           }
        }
    });
}

The while loop will ensure that we’ll try to de-queue the items as long as there’s something left in the collection.
Wait for the tasks and print the number of items processed – the counter should have the same value as the number of items in the queue:


Task.WaitAll(queueTasks);
Console.WriteLine("Counter: {0}", itemCount);



European ASP.NET 4.5 Hosting - Spain :: How to Optimize Your ASP Pages

clock August 14, 2014 13:09 by author Onit

This Article will tell you how to faster loading of your ASP Pages and make the performance better, If you read the internet and all of the websites dedicated to Asp.Net you will inevitably read about the wonders of the DataGrid, DataList, and Repeater controls. While each of these has its place, if you are only displaying data there is a much faster and more efficient means to do so. Let's say you have a page that displays articles based on a query string. A normal asp page execution procedure goes like this. The code queries the database based on the Article I.D. and then brings back that information to the page where you display it in the fashion that you would like. This is a fairly straight forward approach with asp and is done all the time.

 

Check The Easy Step Below!

Use Asp.Net Caching

This is a no-brainer, and I won't go into the brilliance or details of asp.net caching here because at the time of this writing Google has 2,780,000 articles on the topic. Basically instead of querying the database each time the page is loaded you only query the database once and load that result into the system cache. Subsequent calls to load the page retrieve the data from the cache as opposed to the database which gives you an instant and considerable performance boost. You can then set the cache for how long the cache should store the information as well as many other features. If you are not using the cache, you should be whenever possible!

If possible, do NOT use the standard Asp.Net controls.

That's right. The standard asp.net controls are designed for rapid development and not page performance. They allow you to design pages that grab and display data very quickly but their actual performance suffers because of the extra overhead which is there for ease and speed of development time and not page execution speed.

Instead, create either a User Control or even better yet a Web Custom Control which is by far the fastest performance wise and really quite easy to create and use.

Use an SqlDataReader or even better yet use a set based command for Sql Server data retrieval and simply execute that one command against the database.

An asp.net SqlDataReader is a fast forward only datareader that closes the connection after it reads the last set of results. Now for my article pages we are only returning 1 particular result. In this case we would opt for the set based command. If you had more than 1 result returned, in your table of contents for instance, you would use the SqlDataReader because you are returning multiple sets of results.

Set based commands are stored procedures that bring back data through parameters as opposed to a result set which then in turn needs to be looped through to obtain your data. So instead of writing your stored procedure like the following which brings back 1 result set:

Select Title, Body, Author
From Articles
Where ArtID = 215

We can write it using a set based command like this.

Create Procedure mysp_GetArticle

@Title varchar(200) Output,
@Body varchar(8000) Output,
@Author varchar(500) Output


As

Select @Title = Title, @Body = Body, @Author = Author
From Articles
Where ArtID = 215

GO
The above query will return only the three parameters called for and not a result or record set so you
don't have to then walk through the returned record set that has only 1 result in it anyway. This second
little process of work decreases your performance so you should avoid it whenever possible. Combine
this technique with the asp.net cache

Use Classes and ArrayLists as opposed to returning an SqlDataReader.

Create a class and then if there are more than one set of results store those results into individual instantiations of that class. Finally store each of those classes into an ArrayList. You can then store only that ArrayList into the asp.net cache. So instead of getting the results back from a SqlDataReader when loading your page you get them from the ArrayList which is stored in the cache.

On the first time the page loads, query the database and return all of your data storing it into individual classes. Then store each of those classes into an ArrayList. If you only have one single result you may store only the class into the cache. Then take your ArrayList and store it into the cache.

Next create a Web Custom Control and pass the cached ArrayList to the custom control and loop out your data using the HtmlTextWriter which is very fast. Remember each subsequent call to load the page will be called from the cache which stores your ArraList of classes or your single class.

Certainly it takes a significant amount of additional coding to do it in this fashion, especially when you take proper error handling into consideration, but if you follow this approach your pages will be screeching fast, you will immediately notice the difference, and your asp.net pages will execute in the proper sequence - Data handling in the Page_Load function and the html display in the Page_Render function.



European ASP.NET 4.5 Hosting - Spain :: How to Count Your Visitors on Website Using ASP.NET C#

clock August 5, 2014 06:22 by author Scott

This is only simple tutorial how to count number of visitors to a website in asp.net using C#. Just only brief description and hope you enjoy this tutorial

1. First thing to do is open Global.asax file and write the code as shown below

void Application_Start(object sender, EventArgs e)
{
Application["VisitorCount"] = 0;
}

void Session_Start(object sender, EventArgs e)
{
Application["VisitorCount"] = (int)Application["VisitorCount"] + 1;


void Session_End(object sender, EventArgs e)
{
Application["VisitorCount"] = (int)Application["VisitorCount"] - 1;
}

2. Now open your aspx page in which you want to show the count and write the following code.

<div>
<asp:Label ID="lbl_Count" runat="server" ForeColor="Red" /> 

</div>

3. You’ll see the below code in the cs file on page load event

protected void Page_Load(object sender, EventArgs e)
{
lbl_Count.Text = Application["VisitorCount"].ToString();
}

Good luck and hope this tutorial help



About HostForLIFE.eu

HostForLIFE.eu is European Windows Hosting Provider which focuses on Windows Platform only. We deliver on-demand hosting solutions including Shared hosting, Reseller Hosting, Cloud Hosting, Dedicated Servers, and IT as a Service for companies of all sizes.

We have offered the latest Windows 2016 Hosting, ASP.NET Core 2.2.1 Hosting, ASP.NET MVC 6 Hosting and SQL 2017 Hosting.


Tag cloud

Sign in