Posted on

IIS redirect from a site to another site

We must redirect the pages of a site on the pages of another site by changing the main address of the site and keeping the relative addresses of the pages the same. So : will be redirect in

On our server we need to install an additional IIS module: “HTTP Redirection“.

installing http redirection

in IIS, in your site (in this example select Http Redirection module and compile it in this way

this configuration will create a web.config file in your site root :

<?xml version="1.0" encoding="UTF-8"?>
        <httpRedirect enabled="true" destination="" exactDestination="false" childOnly="false" />


more information :

Posted on

Spostare un vecchio sito aspx su un nuovo IIS

Ecco i problemi più comuni che si possono presentare durante lo spostamento di un vecchio sito aspx su nuovo web server Internet Information Server.


Questo problema lo avrete sicuramente quindi sistemate prima di far partire il sito. Quando create un nuovo sito su IIS questi crea un Application Pool separato per il sito ma lo basa sulla versione 4.0 del Framework .net. La vostra applicazione non funzionerà. Dovete selezionare l’Application Pool e modificare la versione del Framework sulla 2.0. A questo punto fate un Recycle dell’Application Pool e un restart del sito.

PROBLEMI con il defaultDocument

Se vi viene segnalato un problema della definizione della default.aspx sul web.config nel tag

                <add value="Default.aspx" />

Vi basta inserire prima della dichiarazione add il tag clear, come di seguito :

                <clear />
                <add value="Default.aspx" />
Posted on Leave a comment


Visual Studio allows us to publish our web site on a web server in the lan (intranet) or on an external web server, for example hosted on Azure.

In the situation of a server on the lan, you have created, through IIS, a site that resides on a certain directory, empty now, on a web server. Otherwise you have already prepared an external site.

In Visual Studio, in the right panel called “Solution Explorer” we click with the right mouse button on our project and select the “Publish” option. The “Publish” window: there are, on the left, the fourth step to do for publication.


Go to the drop down menu at the top center and choose “New Custom Profile”. Invent the name of this profile. Once inserted, you will go directly to the next step.

Connection with “Web Deploy”

Publish Metod : choose “Web Deploy”  whether you publish your site on a server on the lan, both in an external server.

Server (web server in lan) : http://myserver

Server (external, es Azure):

Site name (web server in lan) : name of the directory in which it is to be the site

Site name (external, es Azure) : es. mysite

User Name e Password (web server in lan) : put a administrator user of the server machine. If the machine is in a domain,  use a local administrator.

User Name e Password (esterno) : ftp user

Destination Url : web site address. es : http://……………..


In this tab the program reads from we.config the database connection strings. If your target site database is different, you need to specify the right connection. The publication will replace the target strings to the source strings. We will see later that there is a method to insert in the web.config further changes to the web.config of origin.


Here you can see the files that will be sent to the destination that is the new files or changed since the last submission. And you can publish your site!

web.config configuration

Our destination website may have other special features, specified in web.config, different from the starting site, as well as database connection strings. We can create a specific web.config for each deployment.

Position  the mouse on the project. In the “Properties”, find the directory “PublishProfiles” which contains previously saved data. Here you will find a .pubxml files for each of the deployment that you have created. Go to the file you need, push the right mouse button and select “Add Config Transform”.

If you go in the web.config you will see that there is an additional file named as your deployment. Let’s see some examples of what you can do with the tag that you set within the <configuration>

 <add name="MyDB"
 connectionString="Data Source=ReleaseSQLServer;Initial Catalog=MyReleaseDB;Integrated Security=True"
 xdt:Transform="SetAttributes" xdt:Locator="Match(name)"/>

this stringa substitutes (xdt:Transform=”SetAttributes”) the attributes of the tag named  (xdt:Locator=”Match(name)) “MyDB” with these.

<appSettings><add key="myemail" value="" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/></appSettings>

this stringa substitutes the attributes (xdt:Transform=”SetAttributes”) of the tag with key (xdt:Locator=”Match(key)) “myemai” with these.

 <mailSettings xdt:Transform="Replace">
 <smtp deliveryMethod="Network" ........................

This string transform (xdt:Transform=”Replace”) entire tag mailSettings and its content.