Windows 2012 Hosting - MVC 6 and SQL 2014 BLOG

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

Cheap SQL 2014 Hosting with How to Create Cron Job to Backup Your SQL Database

clock June 20, 2014 08:31 by author Ben

Cron Jobs are used for scheduling tasks to run on the server. They're most commonly used for automating system maintenance or administration. However, they are also relevant to web application development. There are many situations when a web application may need certain tasks to run periodically. A cron job/scheduled task is a system-side automatic task that can be configured to run for an infinite number of times at a given interval. Cron/scheduled task allows you to schedule a command or a script to run at a specific time of day, or on a specific day of the week or at a particular time of day on a specific day of the month. It allow for scheduling down to the minute and up to an annual event.

Here is the simple step how to create Cron Job to Backup Your SQL Database :

Step 1. Create a folder to store the backup in your FTP application
Open your ftp application and connect to the account that has the database you want to back up. Create a folder outside of the webcontent called "backups".

Step 2. Set folder permissions in your FTP application
Right click the folder and add all write permissions. If your Ftp software doesn't do this then checkout the free FTP client called FileZilla.

Step 3. Create a stored procedure that performs the backup with an input parameter for the filename
Connect to your database using a client  and run a query like this. The procedure will be named FullBackup in this example


CREATE PROCEDURE [dbo].[FullBackup]
 @FileName  nvarchar(256)


BACKUP DATABASE [123456_YourDatabase] TO  DISK = @FileName WITH NOFORMAT, NOINIT,  NAME = N'Full Database Backup', SKIP, NOREWIND, NOUNLOAD,  STATS = 10


Step 4. Create a web page that executes the stored procedure
You can use php or for this also. For something this simple, you can use classic asp. That way there is no .dll to deal with and no application restart needed.  Now create a new asp page and called it backupdb.asp.  The contents of the file are as follows. When you are done, upload this file to a folder in your content area.
This script will generate a filename based on the date. If a backup already exists for that date it will increment a version counter until a fresh filename is found. This script will generate 1 file per execution. Modify as needed if you want to increment a single file.  Edit the location & connection string to work for you.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>


    dim thismonth, thisday, thisyear, location, filelename, ver, extention, abolutespath

thismonth= datepart("m", now())
thisday=datepart("d", now())

filename="dbBackup-" & thismonth & "-" & thisday & "-" & thisyear & "_"

absolutepath=location & filename & ver & extention

    set fso = Server.CreateObject("Scripting.FileSystemObject")
while (fso.FileExists(absolutepath)=True)
absolutepath=location & filename & ver & extention

    Set cn = Server.CreateObject("ADODB.Connection")
    cn.connectionString= "Provider=SQLNCLI;Server=mssql05-01.wc1;Database=123456_YourDatabase;Uid=123456_YourUsername; Pwd=Yourpassword;"

   Set cmd = Server.CreateObject("ADODB.Command")
   Set cmd.ActiveConnection = cn
   cmd.CommandText = "FullBackup"
   cmd.CommandType = 4 'adCmdStoredProc
   cmd.Parameters(1) = absolutepath


   Execution complete:  Filename=<%= filename & ver & extention%>


Step 5.  Schedule a Cron job to call the web page.

Access your control panel and go to the features tab of the site with the database. Choose http as the language, Enter the URL to the asp script and your email and Schedule the job for a daily run at an off hour.

Our Special SQL Server 2014 Hosting Complete Features

What we think makes so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other.

Full Remote Access - We allow you full remote connectivity to your SQL Server 2014 Hosting database and do not restrict access in any way.
Easily transfer your existing SQL Server database - With our SQL Server hosting package, there's no need to rebuild your database from scratch should you wish to transfer an existing SQL Server database to us. If you already have a database hosted elsewhere, you can easily transfer the contents of your database using SQL Server Management Studio which is fully supported by our packages. SSMS provides you with an Import/Export wizard which you can use to upload your data and stored procedures with a couple of clicks.

SQL Server 2014 Hosting with :: New Feature in SQL Server 2014 - Business Intelligence

clock June 16, 2014 07:24 by author Kenny

Business Intelligence - New Feature of SQL Server 2014

SQL Server 2014 includes business intelligence (BI) improvements to help build and support vast databases and data warehouses.

Microsoft has been pouring R&D resourcesinto building out its business intelligence (BI) feature set and the upcoming SQL Server 2014 (SQL2014) release will continue that trend. The new release includes enhancements to make data exploration easier, improvements in BI semantic modeling, new offerings to help build and support massive databases and data warehouses, and tools to ensure the quality and consistency of data. Here’s what SQL2014 will do for you with regards to business intelligence:

BI Semantic Model in SQL Server 2014

Microsoft’s improvements in their BI Semantic Modeling (BISM) enables users new ways to build out BI solutions the scale from small, single-person usage to huge Fortune 500 organizations, focusing on credible and consistent data.

Data Exploration Enhancements in SQL Server 2014

Microsoft has more than 300 million users who think of Excel when they think about manipulating data. It only makes sense to reinforce the relationship between Excel and to a wider extent Microsoft Office, as a front end for data manipulation, exploration, and visualization against a SQL Server back end all through the rich and familiar front end of Excel. Microsoft’s new PowerPivot add-in for Excel makes accessing and analyzing data very easy for end users. The new Power View browser-based add-in for Excel adds new, powerful means of visualizing data, wherever it resides. Other new tools include Power Map (formerly known as Project GeoFlow) and Project Data Explorer, for better mapping and geographic data integration and data import into Excel for heterogeneous data sources, respectively.

Enterprise Information Management (EIM)

Enterprises need help controlling the spread of data silos and ensuring the quality and consistency of data. Microsoft has introduced or enhanced several tools to serve this requirement. The Data Quality Services (DQS) tools help enterprises and data stewards manage end-to-end data management by building a knowledge base of data-quality topics. Master Data Services (MDS) adds new features, such as an MDS add-in for Excel, to map objects, reference data, and control dimensions and hierarchies of data.

Big Data

Big data gets even easier in SQL2014. There are lots of new offerings to help build and support massive databases and data warehouses, such as scaling up to 15k partitions in a data store and up to 640 logical cores on high-end database servers. In addition, Microsoft has fully embraced Hadoop in the form of HDInsight, on Windows Azure and Windows Server, to take advantage of unstructured data and the parallel computational approach common to Hadoop applications. PolyBase, also new in SQL2014, is a feature of the SQL Server Parallel Data Warehouse (PDW) which makes combining nonrelational data and traditional relation data an easy and swift process.

Microsoft has just announced new integrated BI functionality for Office 365 Power BI for Office 365. Previous add-on options Data Explorer and Geoflow have been integrated into the BI Suite and have been renamed as Power Query (Data Explorer) and Power Map (Geoflow). Power Query enables users to pull in information from the web or external sources and merge it with local data, providing for an easier method for enriching your internal data. Power Map provides enhanced mapping capabilities and the ability to interact with any geographic data you may have.

SQL 2012 Hosting with How to Handle Deadlock in SQL Server with Script

clock June 13, 2014 09:30 by author Ben

A deadlock is an inevitable situation in the RDBMS architecture and very common in high-volume OLTP environments. A deadlock occurs when two (or more) processes attempt to access a resource that the other process holds a lock on. Because each process has a request for another resource, neither process can be completed. When a deadlock is detected, SQL Server rolls back the command that has the least processing time and returns error message 1205 to the client application. This error is not fatal and may not cause the batch to be terminated.

Here is the simple script to handle deadlock monitoring using T-SQL code

 ADD EVENT sqlserver.xml_deadlock_report
 ADD TARGET package0.event_file(SET filename=N'C:\Temp\Deadlock_Monitor.xel')

For another way, there is two method with script to handle deadlock in SQL Server, such as:

  • method 1

-- ,,
-- ,,
-- ,,,
-- 2004.4--
 exec p_lockinfo
create proc p_lockinfo
    @kill_lock_spid bit=1, --,1 , 0
    @show_spid_if_nolock bit=1 --,,1 ,0
    declare @count int,@s nvarchar(1000),@i int
    select id=identity(int,1,1),,
        =login_time,=open_tran, =status,
    into #t from(
        select ='',
        from master..sysprocesses a join (
        select blocked from master..sysprocesses group by blocked
        )b on a.spid=b.blocked where a.blocked=0
        union all
        select '|__>',
        from master..sysprocesses a where blocked<>0
        )a order by s1,s2

    select @count=@@rowcount,@i=1

    if @count=0 and @show_spid_if_nolock=1
        insert #t
        select ='',
        from master..sysprocesses
        set @count=@@rowcount

    if @count>0
        create table #t1(id int identity(1,1),a nvarchar(30),b Int,EventInfo nvarchar(255))
        if @kill_lock_spid=1
                declare @spid varchar(10),@ varchar(10)
                while @i<=@count
                    select @spid=ID,@= from #t where id=@i
                    insert #t1 exec('dbcc inputbuffer('+@spid+')')
                    if @='' exec('kill '+@spid)
                    set @i=@i+1
            while @i<=@count
                select @s='dbcc inputbuffer('+cast(ID as varchar)+')' from #t where id=@i
                insert #t1 exec(@s)
                set @i=@i+1
        select a.*,SQL=b.EventInfo
        from #t a join #t1 b on

  • method 2

request_session_id as Spid,
Coalesce( + '.' + + isnull('.' +,''), + '.' +, AS Object,
l.resource_type as Type,
request_mode as Mode,
request_status as Status
FROM sys.dm_tran_locks l
LEFT JOIN sys.partitions p
ON l.resource_associated_entity_id = p.hobt_id
LEFT JOIN sys.indexes i
ON p.object_id = i.object_id
AND p.index_id = i.index_id
LEFT JOIN sys.objects o
ON p.object_id = o.object_id
LEFT JOIN sys.schemas s
ON o.schema_id = s.schema_id
LEFT JOIN sys.objects o2
ON l.resource_associated_entity_id = o2.object_id
LEFT JOIN sys.schemas s2
ON o2.schema_id = s2.schema_id
LEFT JOIN sys.databases db
ON l.resource_database_id = db.database_id
WHERE resource_database_id = DB_ID()
ORDER BY Spid, Object, CASE l.resource_type
When 'database' Then 1
when 'object' then 2
when 'page' then 3
when 'key' then 4
Else 5 end

SQL Server 2012 Hosting is Here with FREE Trial!

Start your FREE Trial SQL 2012 Hosting hosting with us and get professional web hosting support! If the service does not meet your expectations simply cancel before the end of the free trial period. Risk FREE! Why wait longer?

You can start from as low as $5.00/month to start hosting your SQL 2012 on our environment. If you do not have a domain name, please do not worry as we will give you one FREE domain name (worth $14.99/year) if you register for any of our hosting plans for 12 months service(*). We will do our best to help you create your first web presence on the internet and we will continuously support the growth of your business.


SQL Server 2014 Hosting with :: Important New Features in SQL Server 2014

clock June 11, 2014 11:19 by author Kenny

Good news, Microsoft release SQL Server 2014 recently. SQL Server 2014 has several compelling new features that can definitely justify an upgrade. For OLTP, the most exciting new feature in SQL Server 2014 is In-Memory OLTP (aka "Hekaton"), which allows you to move individual tables to special in-memory structures. The performance boost can be as huge as 30x.

New In-Memory OLTP Engine

SQL Server 2014 enables memory optimization of selected tables and stored procedures. The In-Memory OLTP engine is designed for high concurrency and uses a new optimistic concurrency control mechanism to eliminate locking delays. Microsoft states that customers can expect performance to be up to 20 times better than with SQL Server 2012 when using this new feature.

Enhanced Windows Server 2012 Integration

SQL Server 2014 provides improved integration with Windows Server 2012 R2 and Windows Server 2012. SQL Server 2014 will have the ability to scale up to 640 logical processors and 4TB of memory in a physical environment. It can scale up to 64 virtual processors and 1TB of memory when running on a virtual machine (VM).

SQL Server 2014 also integrates with several new and improved features in Windows Server 2012 R2 and Windows Server 2012. For example, SQL Server 2014 supports the OSs' new Storage Spaces feature. With Storage Spaces, you can create pools of tiered storage to improve application availability and performance. In addition, SQL Server 2014 can take advantage of the OSs' Server Message Block (SMB) 3.0 enhancements to achieve high-performance database storage on Windows Server 2012 R2 and Windows Server 2012 file shares. Many enhancements were made to SMB 3.0, with the most notable being SMB Transparent Failover and SMB Direct. The new SMB Transparent Failover feature provides highly reliable SMB storage that's fully supported for applications like SQL Server and Hyper-V. With the new SMB Direct feature, you can leverage the NIC's Remote Direct Memory Access (RDMA) feature to provide access speeds for SMB file shares nearing the access speed for local resources.

Enhancements to AlwaysOn Availability Groups

AlwaysOn Availability Groups provides an effective solution for high availability for SQL Server 2012 / 2014 in on-premises deployments as well as for Windows Azure VM deployments. SQL Server 2014 also contains multiple enhancements for AlwaysOn Availability Groups. The maximum number of secondary replicas is increased from 4 to 8. When disconnected from the primary replica or during cluster quorum loss, readable secondary replicas now remain available for read workloads. There are also additional supportability enhancements.  Note that another enhancement is the Add Azure Replica Wizard. This will not be covered, since it requires VPN hardware etc. that is currently not easily available.

Updateable Columnstore Indexes

Things are changing now with SQL Server 2014, because Microsoft has resolved the above mentioned issues – with some magic and illusion: SQL Server 2014 provides you an Updateable Clustered ColumnStore Index! Let’s have a more detailed look on how this magic and illusion happens internally in SQL Server.
The first most important fact is that an underlying direct update of a ColumnStore Index is not possible! It would be too time consuming to do the complete decompress and compress on the fly during your INSERT, UPDATE, and DELETE transactions. Therefore SQL Server 2014 uses help from some magic: Delta Stores and Delete Bitmaps. Let’s have a more detailed look on both concepts.

SQL Server Data Tools for Business Intelligence

The BI aspects of SQL Server have also been improved. Data Tools for Business Intelligence are used to create SQL Server Analysis Services (SSAS) models, SQL Server Reporting Services (SSRS) reports, and SQL Server Integration Services (SSIS) packages. SSDT BI is based on Microsoft Visual Studio 2012. The database also supports Power BI for Office 365, with Power Pivot and Power View for data analysis and visualization.

Power View has been extended to provide support for multidimensional models, and for queries written using Data Analysis Expressions (DAX). A new Excel add-in, Power Query, lets you integrate data into Excel, and Power Map provides 3D mapping.

Why Should Upgrade?

Upgrading to a new release is usually a difficult decision for most organizations. However, SQL Server 2014's new In-Memory OLTP engine, with its promise of significantly improved application performance, offers a very compelling reason to upgrade for customers using SQL Server to support OLTP applications. One great way to find out the type of performance improvement that you might get out of SQL Server 2014's In-Memory OLTP capability is to download and install the SQL Server 2014 Evolution Edition and use the AMR tool to analyze your production workload. The AMR tool supports collecting data on SQL Server 2008 and later instances. This will give you a good idea of the type of performance improvements that you might expect to get using the new In-Memory OLTP engine as well as the changes that you might need to make to implement it. SQL Server 2014's In-Memory OLTP support promises to boost your database application performance to the next level

SQL 2014 Hosting with How to Backup All SQL Databases with Simple Script

clock June 11, 2014 09:16 by author Ben

SQL Server Backup Script to backup SQL Server databases. It loops through all the databases dynamically using a select statement to the master database where all the names of the databases are located on the instance. It backs up each database, except those specified in the WHERE clause which you can add your unwanted databases to be backed up.

Here is the script that will allow you to backup each database within your instance of SQL Server.  You will need to change the @path to the appropriate backup directory.

File Naming Format DBname_YYYYDDMM.BAK

DECLARE @name VARCHAR(50) -- database name 
DECLARE @path VARCHAR(256) -- path for backup files 
DECLARE @fileName VARCHAR(256) -- filename for backup 
DECLARE @fileDate VARCHAR(20) -- used for file name

-- specify database backup directory
SET @path = 'C:\Backup\' 
-- specify filename format

FROM master.dbo.sysdatabases
WHERE name NOT IN ('master','model','msdb','tempdb')  -- exclude these databases

OPEN db_cursor  
FETCH NEXT FROM db_cursor INTO @name  

       SET @fileName = @path + @name + '_' + @fileDate + '.BAK' 
       BACKUP DATABASE @name TO DISK = @fileName 
       FETCH NEXT FROM db_cursor INTO @name  
CLOSE db_cursor  
DEALLOCATE db_cursor

File Naming Format DBname_YYYYDDMM_HHMMSS.BAK

If you want to also include the time in the filename you can replace this line in the above script:
-- specify filename format

with this line:
-- specify filename format

In this script we are bypassing the system databases, but these could easily be included as well.  You could also change this into a stored procedure and pass in a database name or if left NULL it backups all databases.  Any way you choose to use it, this script gives you the starting point to simply backup all of your databases.

Also, if you wanted to bypass some of your user databases you can include them in the NOT IN section as well.
and the next steps :

  1. Add this script to your toolbox
  2. Modify this script and make it a stored procedure to include one or many parameters
  3. Enhance the script to use additional BACKUP options Special SQL Server 2014 Hosting Complete Features

What we think makes so compelling is how deeply integrated all the pieces are. We integrate and centralize everything--from the systems to the control panel software to the process of buying a domain name. For us, that means we can innovate literally everywhere. We've put the guys who develop the software and the admins who watch over the server right next to the 24-hour Fanatical Support team, so we all learn from each other.

  • Full Remote Access - We allow you full remote connectivity to your SQL Server 2014 Hosting database and do not restrict access in any way.
  • Easily transfer your existing SQL Server database - With our SQL Server hosting package, there's no need to rebuild your database from scratch should you wish to transfer an existing SQL Server database to us. If you already have a database hosted elsewhere, you can easily transfer the contents of your database using SQL Server Management Studio which is fully supported by our packages. SSMS provides you with an Import/Export wizard which you can use to upload your data and stored procedures with a couple of clicks.

Use the Promo Code "DBSQL" (without quotes) and receive double SQL Server Space ! This offer valids only from 01st June 2014 to 30th June 2014 and it applies to all the new clients registered during these dates only.

SQL Server 2014 Hosting witrh ASPHostPortal :: New Feature of SQL Server 2014 - SSD Buffer Pool Extension

clock June 11, 2014 07:54 by author Kenny

In this article I'm going to talk about one of the new feature of SQL Server 2014. As you know SQL Server 2014 contains some interesting new features. Although SQL Server Standard Edition is limited to 128GB of memory, teams deploying on Standard Edition have an option to fit more of their working set in low latency storage Buffer Pool Extensions that are introduced with SQL Server 2014. Well, the Buffer Pool is one of the main memory consumers in SQL Server. When you read data from your storage, the data is cached in the Buffer Pool. SQL Server caches Execution Plans in the Plan Cache, which is also part of the Buffer Pool. The more physical memory you have, the larger your Buffer Pool will be (configured through the Max Server Memory setting).

sql server 2014 with

Creating a buffer pool extension for SQL Server 2014 is like being able to define a different page file in Windows. As data pages move into memory, they begin to fill up the buffer pool. If the buffer pool fills up, the less frequently used pages will be paged to disk. Then when they're needed again, they'll be swapped with something else in the buffer pool and moved back into memory. The buffer pool extension option allows you to define an SSD as a buffer file location. Because SSD is so much faster than spinning disk, the paging is considerably quicker, which increases performance dramatically in some cases. You can define a buffer pool extension file up to 32 times the size of your memory.

Prior to SQL Server 2014, the management of data and index pages in the buffer pool was handled by the buffer manager. This has not changed with the release of SQL Server 2014, a change in the architecture has allowed for creation of a hybrid buffer pool. The hybrid buffer pool now consists of the existing buffer pool plus an extension that resides on nonvolatile storage or an SSD. The buffer manager still deals with identifying those pages in the buffer pool that can be expunged, when required pages for a request are not residing in memory but on disk. This practice is still handled and undertaken by the buffer manager. In addition to the buffer manager deciding on which pages should be in the buffer pool or not, it is now identifying those pages which are considered as “clean pages” and migrating those pages out of the buffer pool onto the BPE to allow for even more data to reside in the buffer pool. This practice is providing the following benefits to your SQL Server environment (as stated in the Microsoft BPE article):

  • Increased random I/O throughput
  • Reduced I/O latency
  • Increased transactional throughput
  • Improved read performance with a larger hybrid buffer pool
  • A caching architecture that can take advantage of present and future low-cost memory drives

Why is the Best ASP.NET 4.5.2 Hosting in South Africa?

clock June 10, 2014 12:14 by author Ben, 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. has become an important resource for cutting-edge, high-value hosting solutions. We're a proudly the company with over 35.000 satisfied customers and a reputation as one of the top internet service providers. We also offers low priced enterprise-level hosting plans by focusing their resources on needs by ASP.NET Windows’s developers. claims to be proud of our management staff who have years of experience working in web hosting industry. ASPHostPortal’s aim is to offer the best web hosting value to our clients by offering products and solution in an efficient and effective way.

We support 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:

  • Unlimited Website
  • Latest MS SQL Server 2012 R2
  • ASP.NET 4.5.2/4.5.1/4.5/3.5/2.0
  • IIS 8 with Full trust allowed
  • SmarterMail email System
  • Web-based Plesk Panel hosting
  • Unlimited FTP, Sub domains, mail boxes
  • PHP, MySQL 5 Database

With, customers are always able to run websites with at least 99.9% uptime. ASPHostPortal has 3 top data centers located in New York, USA, Europe and Singapore both of which are equipped with hundreds of 100% Dell servers with 64 bit operating system, dual quad processors, 32 GB Ram and RAID 10 disk arrays. And also our system still reliable in South Africa. Part of our success is down to the fact that we've partnered with one of the biggest network providers in Africa to ensure the quickest and most reliable internet experience for our customers.

Why is the Best ASP.NET Hosting in South Africa?

Reliable Server and Data Center

We now operate 5 different data centers, namely Seattle data center, Houston data center, Washington DC data center, Amsterdam (The Netherland) data center and the newest Singapore (Asia) data center.

Fastest Network
ASPHostPortal has architected its network like no other hosting company. Every facet of our network infrastructure scales to gigabit speeds with no single point of failure.

World Class PLESK Control Panel
We provide one of the most comprehensive customer control panels available. Providing maximum control and ease of use, our Control Panel serves as the central management point for your ASPHostPortal account.

Excellent Expertise in Technology
The reason we can provide you with a great amount of power, flexibility, and simplicity at such a discounted price is due to incredible efficiencies within our business.

In addition, technicians are monitoring the data centers and server 24×7, so we are able to find and resolve sudden issues to avoid any sudden interruption. The following chart shows the real uptime in the past 30 days. also provide our customers a chance to make some money by providing reseller hosting accounts. You can purchase our reseller hosting account, host unlimited websites on it and also have the chance to sell some of your hosting space to others. This can be one of the easiest ways of making some money online. You do not need to worry about hosting stuff as we will take care of all the hosting needs of your clients.

Cheap ASP.NET MVC 5.1.1 Hosting:: How to Integrated PayPal with ASP.NET MVC

clock June 9, 2014 11:26 by author Ben

This article discusses integration of PayPal payment gateway in MVC  web application. PayPal is an online payment service that allows you to pay for purchases, receive payments, or to send and receive money. To receive these services, a person must submit various financial details to PayPal, such as credit card number, transmission can be done by mail. Thereafter, transactions are conducted without having to disclose financial details, an email address and a password is sufficient.

We will look at a simple scenario of taking a user to a PayPal payment page to checkout.

1. Setting up the development tools

  • Creating a PayPal Account

You will need a sandbox account to test your transactions. The sandbox account is separate from a regular account and is all you need to sign up to before you develop and test your code.

  • PayPal Account Settings

It's good practice to put things like account settings in the web.config. The code in this article will access these settings. You must change the sandbox setting to False when using regular account details:

   <add key="PayPal:Sandbox" value="True" />
   <add key="PayPal:Username" value="*" />
   <add key="PayPal:Password" value="*" />
   <add key="PayPal:Signature" value="*" />
   <add key="PayPal:ReturnUrl" value="" />
   <add key="PayPal:CancelUrl" value="" />

2. Creating the button
Now, you will have to create two Views in a Controller, one where you have the button and one where you have the validation mechanism. Let’s start with the button! Put the code below into any View. My View name is IPN in the User controller.
<!-- When you are done with all testing and want to change to the real PayPal, use following instead-->
<form action="" method="post">
<!-- end of Real PayPal example-->
<form action="" method="post">
        <input class="full-width" type="hidden" name="business" value="<!--enter the Business account email here-->">
        <input type="hidden" name="cmd" value="_xclick">
        <input type="hidden" name="item_name" value="The unlimited music download subscription">
        <input type="hidden" name="amount" value="9">
        <input type="hidden" name="no_shipping" value="1">
        <input type=hidden name=RETURNURL
        <input type="hidden" name="return" value="">
        <input type="hidden" name="notify_url" value="">
        <button type="submit">Order now!</button>

3. Processing the information returned by PayPal

The example code is based on this code. Please take a look at it to see how it is done with several variables.

Now you need to create a new View in the controller, called IPN. Insert the following code:
public ActionResult IPN()
    var order = new Order(); // this is something I have defined in order to save the order in the database
    // Receive IPN request from PayPal and parse all the variables returned
    var formVals = new Dictionary<string, string>();
    formVals.Add("cmd", "_notify-synch"); //notify-synch_notify-validate
    formVals.Add("at", "this is a long token found in Buyers account"); // this has to be adjusted
    formVals.Add("tx", Request["tx"]);
    // if you want to use the PayPal sandbox change this from false to true
    string response = GetPayPalResponse(formVals, false);
    if (response.Contains("SUCCESS"))
        string transactionID = GetPDTValue(response, "txn_id"); // txn_id //d
        string sAmountPaid = GetPDTValue(response,"mc_gross"); // d
        string deviceID = GetPDTValue(response, "custom"); // d
        string payerEmail = GetPDTValue(response,"payer_email"); // d
        string Item = GetPDTValue(response,"item_name");
        //validate the order
        Decimal amountPaid = 0;
        Decimal.TryParse(sAmountPaid, System.Globalization.NumberStyles.Number, System.Globalization.CultureInfo.InvariantCulture, out amountPaid);
        if (amountPaid == 9 )  // you might want to have a bigger than or equal to sign here!
            if (orders.Count(d => d.PayPalOrderRef == transactionID) < 1)
                //if the transactionID is not found in the database, add it
                //then, add the additional features to the user account
                //if we are here, the user must have already used the transaction ID for an account
                //you might want to show the details of the order, but do not upgrade it!
            // take the information returned and store this into a subscription table
            // this is where you would update your database with the details of the tran
            //return View();
            // let fail - this is the IPN so there is no viewer
            // you may want to log something here
            order.Comments = "User did not pay the right ammount.";
            // since the user did not pay the right amount, we still want to log that for future reference.
            _db.Orders.Add(order); // order is your new Order
    return View();
string GetPayPalResponse(Dictionary<string, string> formVals, bool useSandbox)
    string paypalUrl = useSandbox ? ""
        : "";
    HttpWebRequest req = (HttpWebRequest)WebRequest.Create(paypalUrl);
    // Set values for the request back
    req.Method = "POST";
    req.ContentType = "application/x-www-form-urlencoded";
    byte[] param = Request.BinaryRead(Request.ContentLength);
    string strRequest = Encoding.ASCII.GetString(param);
    StringBuilder sb = new StringBuilder();
    foreach (string key in formVals.Keys)
        sb.AppendFormat("&{0}={1}", key, formVals[key]);
    strRequest += sb.ToString();
    req.ContentLength = strRequest.Length;
    //for proxy
    //WebProxy proxy = new WebProxy(new Uri("http://urlort#");
    //req.Proxy = proxy;
    //Send the request to PayPal and get the response
    string response = "";
    using (StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII))
        using (StreamReader streamIn = new StreamReader(req.GetResponse().GetResponseStream()))
            response = streamIn.ReadToEnd();
    return response;
string GetPDTValue(string pdt, string key)
    string[] keys = pdt.Split('\n');
    string thisVal = "";
    string thisKey = "";
    foreach (string s in keys)
        string[] bits = s.Split('=');
        if (bits.Length > 1)
            thisVal = bits[1];
            thisKey = bits[0];
            if (thisKey.Equals(key, StringComparison.InvariantCultureIgnoreCase))
    return thisVal;

Please note down the Activation token found in the Buyers account in Profile>My Selling Tools>Website preferences> Update. Then, enable auto return and payment data transfer. There, you will also find the Activation token which you should add to:
formVals.Add("at", "this is a long token found in Buyers account");


Why you should choose for your Cheap ASP.NET MVC 5.1.1 Hosting?

  1. Daily Backup Service

    We realise that your website is very important to your business and hence, we never ever forget to create a daily backup. Your database and website are backup every night into a permanent remote tape drive to ensure that they are always safe and secure. The backup is always ready and available anytime you need it.

  2. Experts in ASP.NET MVC 5.1.1 Hosting

    Given the scale of our environment, we have recruited and developed some of the best talent in the hosting technology that you are using. Our team is strong because of the experience and talents of the individuals who make up

  3. Excellent Uptime Rate

    Our key strength in delivering the service to you is to maintain our server uptime rate. We never ever happy to see your site goes down and we truly understand that it will hurt your onlines business. If your service is down, it will certainly become our pain and we will certainly look for the right pill to kill the pain ASAP.

  4. 24/7-based Support

    We never fall asleep and we run a service that is operating 24/7 a year. Even everyone is on holiday during Easter or Christmas/New Year, we are always behind our desk serving our customers.

  5. Advanced Technology provides various editions of the important ASP.NET MVC frameworks, including basic ASP.NET MVC, ASP.NET MVC 2, ASP.NET MVC 3, ASP.NET MVC 4, ASP.NET MVC 5, ASP.NET MVC 5.1 and the latest ASP.NET MVC 5.1.1 . All of these frameworks enable customers to have a high level of flexibility and avoid compatible issue.

ASPHostPortal Web Hosting Announces Release of New Free 7 Days ASP.NET MVC 5.2 Hosting

clock June 6, 2014 07:56 by author Ben

Windows and ASP.NET hosting specialist,, has announced the availability of new hosting plans that are optimized for the latest update of the ASP.NET MVC  technology. The ASP.NET MVC 5.2 Release Candidate is now available to developers for immediate download. ASP.NET MVC 5.2 is the latest update to Microsoft's popular MVC (Model-View-Controller) technology - an established web application framework. This package contains the runtime assemblies for ASP.NET MVC. ASP.NET MVC gives you a powerful, patterns-based way to build dynamic websites that enables a clean separation of concerns and that gives you full control over markup. ASP.NET MVC 5.2  brings bootstrap into the default MVC template, authentication filters, filter overrides and attribute routing.  Attribute Routing on ASP.NET MVC 5.2 now provides an extensibility point called IDirectRouteProvider, which allows full control over how attribute routes are discovered and configured. - a cheap, constant uptime, excellent customer service, quality and also reliable hosting provider in advanced Windows and ASP NET technology. hosts its servers in top class data centers that is located in United States to guarantee 99.9% network uptime. All data center feature redundancies in network connectivity, power, HVAC, security, and fire suppression. All hosting plans from include 24×7 support and 30 days money back guarantee.

“We pride ourselves on offering the most up to date Microsoft services. We're pleased to launch this product today on our hosting environment” said Dean Thomas, Manager at “We have always had a great appreciation for the products that Microsoft offers. With the launched of ASP.NET MVC 5.2 hosting services, we hope that developers and our existing clients can try this new features. Now, you don’t need to spend a lot of money to get ASP.NET MVC 5.2 hosting.”

For more information about new ASP.NET MVC 5.2, please visit

As a leading hosting provider, offers a comprehensive range of services including domain name registrations, servers, online backup solutions and dedicated web hosting. is well placed to deliver a high quality service.

About is a hosting company that best support in Windows and ASP.NET-based hosting. Services include shared hosting, reseller hosting, and sharepoint hosting, with specialty in ASP.NET, SQL Server, and architecting highly scalable solutions. As a leading small to mid-sized business web hosting provider, strive to offer the most technologically advanced hosting solutions available to all customers across the world. Security, reliability, and performance are at the core of hosting operations to ensure each site and/or application hosted is highly secured and performs at optimum level.

Cheap Windows Hosting Based in USA:: How to Fix SQL Injection Vulnerabilities in ASP.NET

clock June 5, 2014 07:07 by author Ben

Simply stated, SQL injection vulnerabilities are caused by software applications that accept data from an untrusted source (internet users), fail to properly validate and sanitize the data, and subsequently use that data to dynamically construct an SQL query to the database backing that application. For example, imagine a simple application that takes inputs of a username and password. It may ultimately process this input in an SQL statement of the form

string query = "SELECT * FROM users WHERE username = "'" + username + "' AND password = '" + password + "'";

Since this query is constructed by concatenating an input string directly from the user, the query behaves correctly only if password does not contain a single-quote character.

Impact of SQL Injection vulnerabilities

  • Reading, Updating and Deleting arbitrary data from the database
  • Executing commands on the underlying operating system
  • Reading, Updating and Deleting arbitrary tables from the database

There are many way finding SQL Injection Vulnerabilities manually. But, in this article, I will show you how to find SQL Injection Vulnerabilities automatically. It’s no different than finding it manually. The process mainly involves three tasks :

  • Identifying Data Entry.
  • Inject Data to Database.
  • And last, detect anomalies from it’s response

you will see that you can do it automatically to a certain process. Identifying data entry (1st step) is something that can be automated. You can do it by just crawl the website and finding GET and POST request. As well ass Data Injection (2nd step), can also be done in an automatic fashion. The main problem is the 3rd step ( Detect Anomalies Response of Remote Server ). Although this part is easy for human to detect. it sometimes very difficult for a bot or software to detect it and fully understand output of the remote server. For example, when the web application returns the SQL error from database or when the web application returns HTTP 500 code error.

How to Fix SQL Injection Vulnerabilities in ASP.NET

c# code:

string queryText = "SELECT * FROM Students WHERE City=@City";
SqlCommand cmd = new SqlCommand(queryText, conn);
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
return ds;

ASP.NET code:

/*C# code*/
string commandText = "SELECT * FROM Customers WHERE Country=@CountryName";
SqlCommand cmd = new SqlCommand(commandText, conn);

Stored Procedure:

var connect = ConfigurationManager.ConnectionStrings["NorthWind"].ToString();
var query = "GetProductByID";
using (var conn = new SqlConnection(connect))
  using (var cmd = new SqlCommand(query, conn))
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.Add("@ProductID", SqlDbType.Int).Value = Convert.ToInt32(Request["ProductID"]);
    //Process results

Fixing the SQL Injection Vulnerabilities would not be enough to protect your web application. You need to protect it using Runtime Protection.

Cheap SQL Hosting with
Providing the best security, compliance, performance, and managed service separates from other hosting companies. MS SQL server supports our commitment to providing service options the businesses that choose demand. Use the Promo Code "DBSQL" (without quotes) and receive double SQL Server Space!


We’re a company that works differently to most. Value is what we output and help our customers achieve, not how much money we put in the bank. It’s not because we are altruistic. It’s based on an even simpler principle. "Do good things, and good things will come to you".

Success for us is something that is continually experienced, not something that is reached. For us it is all about the experience – more than the journey. Life is a continual experience. We see the Internet as being an incredible amplifier to the experience of life for all of us. It can help humanity come together to explode in knowledge exploration and discussion. It is continual enlightenment of new ideas, experiences, and passions

 photo ahp banner aspnet-01_zps87l92lcl.png

Author Link

Corporate Address (Location)

170 W 56th Street, Suite 121
New York, NY 10019
United States

Sign in