European Windows 2019 Hosting BLOG

BLOG about Windows 2019 Hosting and SQL 2019 Hosting - Dedicated to European Windows Hosting Customer

European Windows Hosting :: How to Block a Website on Your Computer

clock January 13, 2012 07:20 by author Scott

If you would like to block a website from being viewed on your Windows computer, follow these steps:

1. You need to run C:\WINDOWS\system32\drivers\etc

2. Then, backup the
hosts file.

3. Open hosts file there from the notepad.

4. At the end of the line you can see as per below.

127.0.0.1 localhost

5. Append the following line at the end

127.0.0.1 BlockSitename.com # replace the BlockSitename.com with the site name that you want to block.

6. Then go to Start->Run-> type ipconfig /flushdns



European Windows Hosting :: DNS Tools - How to Use Traceroute?

clock January 12, 2012 06:59 by author Scott

In this tutorial, I will show you how to use Traceroute on your Windows. Please go to Startà Runà Cmd. Then, you must type tracert, give a space then add your domain name. See this example below:



IP Whois – Also pronounced as Who is, this tool is more often used to know information about the IP address of a particular domain, its location and the details about the registrar and owner. It basically is a query and response protocol used extensively to lookup to databases holding information about registered users of an Internet resource.

Reverse DNS lookup – Also referred to as the rDNS, it is mandatory to have it on your server. It is used for determining the association of a domain name with a particular IP address using the Domain Name System (DNS) of the Internet.

SPAM DB Lookup – This tool enables server administrators to look for the possible accounts on server to be included in the spammers list. Spam DB lookup enables them to check if the server and its IP’s have been added to the list due to a possible spamming activity carried out by someone using the server.

DNS Lookup – DNS lookup is used to determine various DNS records such as A, MX records, CNAME etc. for a particular domain. Using this simple tool, one can check where a particular site is hosted.



European Windows Hosting :: How to Fix Failed to Retrieve Directory Listing in Filezilla

clock January 10, 2012 08:15 by author Scott

Yesterday, we have just talked about how to connect FTP with Web Browser. In this tutorial, I will show you the error message that sometimes shown when we connect with Filezilla. This in a common error message that you will find on Filezilla:

Failed to retrieve directory listing.

Here is the image:



As the image shows, the connection enters Passive (PASV) Mode and after that, the error occurs. A solution that could work, is to disable passive mode. Here’s how you do that in FileZilla:

- Open Filezilla, go to Edit -> Settings
- Click on Connection -> FTP: Choose Active
- Click on Connection -> FTP -> Active Mode: Select "Ask your operating system for the external IP address”
- Click on Connection -> FTP -> Passive Mode: Choose Fall Back to Active Mode
- Press OK.



Hope it helps. Good luck



European Windows 2008 Hosting :: Connect to FTP with Internet Explorer or Web Browser

clock January 9, 2012 16:40 by author Scott

There are many ways to connect by FTP to a host, we can use tools such as Filezilla, CoreFTP, or SmartFTP. But I would recommend to use Filezilla, very simpe, FREE, and easy to use. In this article, I will assume you cant connect or you don’t have a FTP client software. So, in this case you need to use Internet Explorer to connect it.

You can upload and delete files at your online server using Internet Explorer.

In order to connect by FTP with your browser, use the following address:

ftp://FtpUserID:[email protected]

For example, let’s assume the following:

FTP User: HostForLife
Password: googletest
Site: www.testFTP.com

The above information would use the following in the Internet Explorer Address bar:

ftp://HostForLife: [email protected]

However, if your FTP user used to connect is similar to [email protected], then you will have to URL encode it like this:

ftp:// FtpUserID%40YourDomainName.com:[email protected]

In the case above, it is important to note what the FTP username is:

FtpUserID%40YourDomainName.com

This address is URL-encoded and comes from [email protected] where @ has been substituted with %40, which is the ASCII code for @.

After visiting your website by using the above exampled address, Internet Explorer will open the site content in its window. Then from the “View” menu of Internet Explorer, you may select “Open FTP site in Windows Explorer” to edit, upload or delete the files at your web server.

Hope this tutorial will help you.



European Windows 2008 Hosting :: How to Solve Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

clock December 20, 2011 06:02 by author Scott

The Scenario:

Sometimes you may get a timeout issue looking something like this:

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
   at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
   at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()
   at System.Data.SqlClient.SqlDataReader.get_MetaData()
   at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
   at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)
   at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)
   at System.Data.SqlClient.SqlCommand.ExecuteReader()

The important part here is what is in the exception message:


System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.

This may give you the impression that the server is down or something similar.

However, this is basically the SqlCommand.CommandTimeout property that has expired; the default timeout is 30 seconds.

See more at:

".NET Framework Class Library -> SqlCommand.CommandTimeout Property"

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlcommand.commandtimeout.aspx

Now, why would it time out?

There are 2 common reasons.

Long running tasks or uncommitted transactions. Let's show this by example.

In the first example, we emulate that the command execution takes a very long time to execute and return, for example there could be millions of rows being updated or for some other reason the execution takes a long time.

In the code I just call the SQL Server method "waitfor delay" that will pause the execution in SQL Server for 30 seconds, I then change the SqlCommand.CommandTimeout  from 30 seconds to 10 seconds so that we do not have to sit all day and wait for the exception. The code should be pretty self explanatory, just create a console application in Visual Studio.

Note that we connect to the trusty Northwind, if we would set the CommandTimeout to 60 seconds, then after 30 seconds we would get our Shippers table data back.

        static void Main(string[] args)
        {
            string cString = @"Data source=<your server>;Integrated Security=SSPI;Initial Catalog=Northwind";
            using (SqlConnection sc = new SqlConnection(cString))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("waitfor delay '00:00:30';select * from Shippers", sc);
                    cmd.CommandTimeout = 10;
                    Console.WriteLine("CommandTimeout: {0}", cmd.CommandTimeout);
                    sc.Open();
                    SqlDataReader r = cmd.ExecuteReader();
                    while (r.Read())
                        Console.WriteLine("{0} : {1}", r[0].ToString(), r[1].ToString());
                    sc.Close();
                }
                catch (SqlException se)
                {
                    Console.WriteLine(se);
                }
            }
        }

Run it, and after 10 seconds you will get the exception:

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   ...

For the second reason, that there might be an uncommitted transaction, again we will use Northwind running the following the code, almost the same as above (only difference is that there is no call to “waitfor delay” in the SQL):

        static void Main(string[] args)
        {
            string cString = @"Data source=<your server>;Integrated Security=SSPI;Initial Catalog=Northwind";
            using (SqlConnection sc = new SqlConnection(cString))
            {
                try
                {
                    SqlCommand cmd = new SqlCommand("select * from Shippers", sc);
                    cmd.CommandTimeout = 10;
                    Console.WriteLine("CommandTimeout: {0}", cmd.CommandTimeout);
                    sc.Open();
                    SqlDataReader r = cmd.ExecuteReader();
                    while (r.Read())
                        Console.WriteLine("{0} : {1}", r[0].ToString(), r[1].ToString());
                    sc.Close();
                }
                catch (SqlException se)
                {
                    Console.WriteLine(se);
                }
            }
        }

Run this code and you should get the rows in the Shippers table returned.

Now, open Query Analyzer or Sql Server Management Studio and execute an uncommitted transaction on the Shippers table, like so:

use Northwind
go

begin tran
 update Shippers set CompanyName = 'aaaaa' where ShipperID = 1
--commit

(Note that the new value, in this case 'aaaaa' must be different compared to the existing one in order to see the problem)

Rerun the code above, and after 10 seconds you will, again, get the exception:

System.Data.SqlClient.SqlException: Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
   ...

Go back to Query Analyzer or Sql Server Management Studio and commit the transaction, rerun code, and you will once again get the Shippers table data returned.

So to summarize, if the command you are executing is a long running one, adjust the CommandTimeout accordingly. If there are uncommitted transactions, you need to find what and where they are and change your code or your stored procedures accordingly.This is outside the scope of this blog, but one way to check for uncommitted transactions is to from QA or SSMS run the following:

dbcc opentran ('Northwind')

This will show if there are any blocked spids in the Northwind database which could be an indication of uncommitted transactions and queries that are blocked as a result of this.

It may seem obvious that a command times out if the command timeout expires. The background for this post is that I had a case where occasionally my customers’ users could not log in to their system. There was no clear pattern to this, and what happened when they tried to log in was that they got the exception above.  In the end it turned out that they had a page in the application that allowed the user to change employee information.

The problem was that when they made the change, they opened a transaction, however, they did not commit it until the user pressed a Save button. The interval between starting the edit of the employee information and the saving of it could be anything, either they made the change and saved immediately, or they made the change and went to lunch without saving.

During this time, all the logins would fail since the login functionality basically did a select from the employee table with the users’ login and password, which subsequently failed since the table was locked by the uncommitted transaction.

Once this was figured out, and the changes were made, all was well in login land.



HostForLife.EU now supports Web Deploy 2.0 Hosting

clock December 15, 2011 10:24 by author Scott

HostForLIFE.EU has supported Web Deploy technique on all our hosting plans. With a web deploy technique, a customer can efficiently synchronize sites, applications or servers across your IIS 7.0 server farm by detecting differences between the source and destination content and transferring only those changes which need synchronization.

What is Web Deploy 2.0?

Web Deploy (Web Deployment Tool) simplifies the migration, management and deployment of IIS Web servers, Web applications and Web sites. Administrators can use command-line scripting with Web Deploy to synchronize IIS 6.0 and IIS 7.0 servers or to migrate an IIS 6.0 server to IIS 7.0. Web Deploy Tool also enables administrators and delegated users to use IIS Manager to deploy ASP.NET and PHP applications to an IIS 7.0 server. 


Web Deploy 2.0 Features             

·    Seamless integration with IIS 7.0 Manager and Visual Studio 2010 interface for creating packages and deploying them onto a machine, both locally and remotely

·    Seamless integration with the Web Platform Installer to install community web applications simply and easily.

·    Web application packaging

·    Web application deployment

·    Web server migration and synchronization

·    In addition to the IIS Manager and Visual Studio 10, tasks can be performed using the command-line or public APIs.



European WebMatrix Hosting :: How to Deploy WebMatrix Hosting

clock December 9, 2011 06:41 by author Scott

WebMatrix is a free tool from Microsoft that makes the task of creating, editing and publishing your website easy. It allows you to intelligently publish only the files that have changed locally, automatically configure your server for maximum compatibility, and keep your development environment in sync with the live published version of your site.

In order to build sites using WebMatrix, you'll first need to install it on your local computer or development machine.  
Click here for the download.

In order to publish sites to our servers using WebMatrix, you'll need to be sure your plan supports it. Currently all ASP.NET plans hosted on Windows 2008/IIS7 and ColdFusion 9 plans support WebMatrix.

Once you're ready to publish your site onto our live servers, you'll need to configure your Publish Settings.

1. First, be sure you're on the Site view in WebMatrix.



2. Go to the Publish drop down, under the Home tab, then select Settings.



3. From Publish Settings, select the Web Deploy protocol from the drop down (alternately, you can use FTP).

4. For Server, enter in your site's IP address.

5. For User Name, enter a valid Site User set up on your account.  If you recently ordered your site, this would be the username you set up during signup.

6. For Password, enter in the password associated with your Site Username.

7. For Site Name, enter in your domain name without the extension (e.g. .com, .net, .org, etc.), and the words "web site" after it.  For example, if your domain was "domain.com", you would enter "domain web site" in the Site Name field.  The site name is based on how your site's name is entered in IIS, and this is the naming convention we use to identify your site on the server.

8. For Destination URL, enter in the URL for the web site/application you're publishing.



9. To ensure your Web Deploy settings in WebMatrix is correct or working correctly, click Validate Connection.

WebMatrix is ready.

10. To create a Database connection, be sure your in the Databases view.

11. Under the Home tab, select New Connection.



To connect to a database, you'll need to:

1. Enter in your database name

2. The database type.

3. The server location. 

4. And then your database Login and Password.



Database Connection Strings

SQL Server Database
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;

MySQL Database
Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;



SQL 2008 Europe Hosting :: How to Send Automated Job Email Notifications in SQL Server with SMTP

clock December 7, 2011 09:53 by author Scott

When you have automated backup jobs running on your database server, sometimes you forget that they are even running. Then you forget to check to see if they are running successfully, and don’t realize until your database crashes and you can’t restore it since you don’t have a current backup.

That’s where email notifications come in, so you can see the job status every morning when you are sipping your coffee and pretending you are working.

SQL Server provides a built-in method of sending emails, but unfortunately it requires you to have Outlook and a profile installed on the server, which isn’t necessarily the ideal way to send an email. Thankfully there is another method, that involves installing a stored procedure on your server that will allow you to send email via SMTP.

You will want to edit one line in the stored procedure to put the IP address of your SMTP server:

EXEC @hr = sp_OASetProperty @iMsg, ‘Configuration.fields(“http://schemas.microsoft.com/cdo/configuration/smtpserver”).Value’, ’10.1.1.10′

Install the stored procedure into the master database, so it can be easily used from wherever needed.

Open up the SQL Server Agent \ Jobs list, and select the properties for the job you are trying to create a notification for:



Click on the Steps tab, and you should see a screen that looks like this:



Click the New button to create a new job step. We will use this step to send the email notification on success.

Step Name: Email Notification Success

Enter this SQL into the Command window as seen below. You will want to customize the email addresses and message subject to match your environment:

exec master.dbo.sp_SQLNotify ‘[email protected]’,'[email protected]’,'Backup Job Success’,'The Backup Job completed successfully’



Click OK and then click the New button again to create another step. This will be the failure notification step.

Step Name: Email Notification Failure

SQL:

exec master.dbo.sp_SQLNotify ‘[email protected]’,'[email protected]’,'Backup Job Failure,’The Backup Job failed’

Now the idea is to make the items follow a specific workflow. First click Edit on step 1, and set the properties as shown here:



What we are saying is that on success, go to the success step, and on failure, go to the failure step. Pretty simple stuff.

Now edit the second step, the one labled “Email Notification Success”, and set the properties as seen here:



We are saying that if the notification job is successful, then just quit the job without running step 3. If we don’t specify this, then we will end up getting two emails, one with success and one with failure.

Now edit the third step, the one labled “Email notification failure”, and set the properties as seen here:



Now your job steps should look like this:



You should now have email notifications in your inbox for either success or failure.



How to Encrypt and Decrypt connectionString section in Web.config

clock November 22, 2011 06:01 by author Scott

Here is the source code to encrypt and decrypt <connectionString> section in Web.config using RSA Protected Configuration provider model.

Note that below source code is from class library file. It is quite feasible to edit the code and use within a button click event as you wish.

Hope you find it useful!!

using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
//specific to configuration
using System.Configuration;
using System.Web.Configuration;
using System.Web.Security;
namespace WebUtils
{
/// <summary>
/// Contains methods for Encrypting and decrypting connectionStrings
/// section in web.config
/// current encryption configuration model is Rsa,
/// it is feasible to change this to DataProtectionConfigurationProvider
/// </summary>
/// <author>Raju Golla</author>
public class EncryptDecrypt
{
//Get Application path using HttpContext
public static string path = HttpContext.Current.
Request.ApplicationPath;
/// <summary>
/// Encrypt web.config connectionStrings
/// section using Rsa protected configuration
/// provider model
/// </summary>
#region Encrypt method
public static void EncryptConnString()
{
Configuration config = WebConfigurationManager.
OpenWebConfiguration(path);
ConfigurationSection section =
config.GetSection("connectionStrings");
if (!section.SectionInformation.IsProtected)
{
section.SectionInformation.ProtectSection
("RsaProtectedConfigurationProvider");
config.Save();
}
}
#endregion
/// <summary>
/// Decrypts connectionStrings section in
///web.config using Rsa provider model
/// </summary>
#region Decrypt method
public static void DecryptConnString()
{
Configuration config = WebConfigurationManager.
OpenWebConfiguration(path);
ConfigurationSection section =
config.GetSection("connectionStrings");
if (section.SectionInformation.IsProtected)
{
section.SectionInformation.UnprotectSection();
config.Save();
}
}
#endregion
}
}

References:

http://msdn.microsoft.com/en-us/library/ms998280.aspx



European WebMatrix Hosting :: Using WebMatrix and Razor to Develop ASP.NET Web Pages

clock November 18, 2011 06:54 by author Scott

Developing database-driven websites using the ASP.NET Web Pages Framework, WebMatrix and Razor is not evil as most professional ASP.NET Web Developers might think. It is hard to look back on the 90's and Classic ASP websites with much optimism as ADO, millions of include files, and spaghetti code literally became the norm. Maintaining them was an utter nightmare in most cases.

This is a different time, however, and Microsoft.Data.dll is much better than ADO, the Razor Syntax is much better than VBScript, and a lot of the security concerns around Encoding, SQL Injection, proper validation, etc. are much more well-known and publicized than it was when Classic ASP first came on the scene. At the time, we also didn't have other frameworks, like WebForms and ASP.NET MVC, and other options for data access, like LINQ To SQL and Entity Framework, so we were pretty stuck making all kinds of crazy mistakes given there wasn't another avenue for more complicated websites.

WebMatrix, the ASP.NET Web Pages Framework with Razor, and Microsoft.Data.dll fit a particular need and development environment around simple, forms-over-data websites that are nothing more than a thin layer on top of a database. Personally, at this level, anything that attempts to abstract the fact that we are just pumping data from the database onto a web page is overcomplicating the issue and making the application more difficult to maintain.

As an example, take your typical Recent News or Recent Posts page on a personal website that literally pulls data from a single table based on either a publication date or id. I see no reason to create an ASP.NET MVC or WebForms website in Visual Studio with an O/R Mapper, Visual Designer, codebehind files, view model, a bloated web.config, and other nonsense when you can just take your favorite text editor and add a few lines of Razor syntax into a page in a few minutes with a much simpler deployment model.



This is far more easier to maintain than a similar application written with ASP.NET WebForms or ASP.NET MVC. Here we have 1 file that can easily be understood in any text editor with a clear understanding that this data is coming from a database using a particular query and dumped onto a web page. Want to sort it differently? Want to display more than 20 stories? It is pretty darn clear and pretty darn easy to make those changes and any changes that fit this simple, database-driven niche.

Other than those 3 lines at the top this looks pretty close to a view in the ASP.NET MVC Framework. If things get much more complicated and you need to offer a layer of abstraction and separate out concerns, you could move those 3 lines out of the view and migrate to MVC. I suspect such an application wouldn't grow to such a need, but if it does, there is a path to a more appropriate framework.

Also noticed that by default everything is HTML Encoded with less chance for JavaScript Injection. I have to work around the framework and use an HtmlString to display the body of the post to allow raw HTML to be displayed. We didn't have automatic encoding with Classic ASP :)

Although nothing is perfect and mistakes will be made by new developers, it won't be anything like the 90's and Classic ASP. This is good stuff for simple forms-over-data websites. As professional web developers I realize we worked long and hard to learn how to properly architect complex web applications, but I think the pendulum may have swung a bit too far and we forget the joy, ease, and beauty of developing simple websites using simple techniques and simple tools.



About HostForLIFE

HostForLIFE 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 2019 Hosting, ASP.NET 5 Hosting, ASP.NET MVC 6 Hosting and SQL 2019 Hosting.


Month List

Tag cloud

Sign in