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

European Visual Studio 2010 Hosting :: Data Schema Comparison in Visual Studio 2010

clock November 21, 2011 05:19 by author Scott

Visual Studio 2010  has some inbuilt functionality as a tool to compare the different schemas .Schema comparison is a powerful tool that is used to compare database schemas. In tips I will give some basic step to compare schemas in Visual Studio 2010

First launch the Schema Comparison tool from Data > Schema Compare > New Schema Comparison .

This will launch a New Schema Compare Tool where you can set Source and Target Schema

The result when source and target schema are same is displayed below

The result when source and target schema were somewhat different is displayed below

European ASP.NET 4 Hosting :: HTML Encoded Expressions in ASP.NET4

clock November 18, 2011 07:51 by author Scott

Today I would like to discuss an interesting feature that is available only in ASP.NET4. It is primarily used in MVC3 applications.

ASP.NET 4.0 comes with a Encoded Expressions <%: expression %> that will automatically convert string into html encoded. Now we can replace all occurrences of <%= %> with <%: %>.

SO what is the difference between these two? Are they same?

No they are not. The main difference is when you use the new syntax our code get encoded. Any html script in side do not gets executed by the browser.

It is just treated as content. In the previous versions you might be using Server.HtmlEncode(<%=expression %>).

So this new syntax does exactly same function as this method. We can use HtmlString type to indicate encoding is unnecessary.

Proof of Concept

I have created a Test method that returns string and that string has some HTML characters like < > to be encoded

public static string Test()
    return "alert('Hello World!!! returns javascript');  HTML Encoded expression";

Now add 2 aspx pages. In the first page add this code.

<form id="form1" runat="server">
    <strong><%: Test()%></strong>

Now In the Second aspx page use this syntax

<form id="form1" runat="server">
    <strong><%= Test()%></strong>

Run this pages on the browser one after the other. Now if you observe, first page gives a just text where as 2nd page is not encoded it returns the script alert message along with text . And look at the viewsource you can see the difference exactly.


-    General security threats for ASP.Net Web applications are Cross-site script injection attacks and HTML encoding attacks. This feature is nice handy way to eliminate javascript injection in your web applications.

-    Now it is easy to replace <%=exp %> to <%:exp%> and make your code or data more secured.

-    Now We do not need to specify Validate-Request to validate HTML Scripts in ASP.NET, which you may be doing it in web.config or pagelevel

Is it not so interesting?. So start playing with the feature.

Hope this helps. Let me know if any questions are clarifications.

European ASP.NET 4.5 Hosting :: Visual Studio 2011 Preview - Server Side Event Handler Generation from ASP.NET Markup

clock November 11, 2011 06:08 by author Scott

Yes, Visual Studio 2011 will coming soon. This is really a great addition in Visual Studio 2011 Developer Preview for ASP.NET developers. If you are familiar with  WPF and XMAL development in Visual Studio, it should be well known for you, because  preview version of Visual Studio supports  generation of  event handler code from XMAL markup itself.  With Visual Studio 2011 developer preview, creating event handlers for ASP.NET controls have become significantly easy. You really don’t not need to write the event handler manually or  generating the even handler from design view.

In VS 2011 Developer preview, markup intellisense for all ASP.NET server-side events will show you list of exiting handlers and a value called “<Create New Event>” . Which means you can attach the event with some exiting event handler or  select “create New event” to generate an new  handler with the right signature in the code-behind file.

If there is no control Id provided, Visual Studio will consider the control id as “Unnamed” and will generate the event handler as shown in below.

If you are wondering  about what will happen if there are multiple controls  without ids, does Visual studio going to attach with same event handler? No, It will  append an incremental number with event handler name.

Visual Studio will generate Event handler name as <ControlName>_Click if control id is provided.

European ASP.NET Hosting :: How to Connect MySQL Server with .NET in C# or ASP.NET

clock November 8, 2011 05:18 by author Scott

In this tutorial, I will show you how to connect to MySQL Server with .NET in C# or ASP.NET. What requirements do you need?

1. Please download
MySQL Connector/Net.
2. After you add a reference to your project, it is probably in C:\Program Files\MySQL\MySQL Connector Net 5.0.7\Binaries\.NET 2.0 folder, add the MySql.Data.dll file as a reference.
3. Make your connection string, the following code will shows a standard MySQL connection string

using MySql.Data.MySqlClient;
public static string GetConnectionString()
string connStr =
String.Format("server={0};user id={1}; password={2};
database=yourdb; pooling=false", "yourserver",
"youruser", "yourpass");

return connStr;

4. Then create an instance from MySql.Data.MySqlClient.MySqlConnection as shown below.

MySql.Data.MySqlClient.MySqlConnection mycon
= new MySqlConnection( GetConnectionString());

5. Then try to open the MySQL connection.

if(mycon .State != ConnectionState.Open)
mycon .Open();
catch (MySqlException ex)
throw (ex);

Simple right?? J

About 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