Encrypting parts of web.config file in asp.net


In order to encrypt the parts of web.config file, esp: connectionStrings section the following command can be executed

Note down the name of the site in the IIS Web Server [Ex: ConnectionStringEncryptionTest]

Open windows command prompt as an administrator,

Execute the following command

C:\Windows\system32>%systemroot%\system32\inetsrv\APPCMD list site “ConnectionSt
ringEncryptionTest”
SITE “ConnectionStringEncryptionTest” (id:4,bindings:http/*:99:,state:Started)

CD to the directory where the source code resides, and then execute the following command from a Visual Studio command prompt, again running as “Administrator”

aspnet_regiis.exe -pe "connectionStrings" -app "/" -site "4"

In case of the site being hosted in the default web site, we can use the “-app” parameter alone instead of the -site parameter.

 

References:

 

Stackoverflow

Encryption Note 1

MSDN

Advertisements

Configuring AD FS 3.0 in Windows Server 2012 R2


The following screenshots illustrate the various steps to get started with AD FS 3.0

Steps to get started with AD FS 3.0

  1. Create a web app [MVC 5] in VS
  2. Enable SSL and copy the URL

vs_url

adfs_in server

rp_mgmt

add_rp_1

add_rp_2

add_rp_3

add_rp_5

add_rp_6

add_rp_7

add_rp_8

add_rp_9

add_rp_10

add_rp_11

add_rp_12

add_rp_13

add_rp_14

add_rp_15

 

 

adfs3_source_code
Add-AdfsClient -ClientId MyWebClient -Name MyWebClient -RedirectUri “https://localhost:44302/authcallback”

 

Hope this helps

Using IIS Express from the Command Line


The following code snippet can be used to run the IIS Express [8.0] in my case to be run from the command line.

The parameters are the path to the main directory, the target libraries [dll’s] should be in a folder ┬ácalled as “bin” inside this given path for the IIS to pick up and run.

The other parameter is the “port” which specifies which port should IIS Express listen for the incoming request. It also logs in the requests and the response status etc in the command line.

Sample :┬ác:\Program Files\IIS Express>iisexpress.exe /path:”C:\Users\Saravanan\Documents\Visual Studio 2012\Projects\console_app_in_iis\console_app_in_iis” /port:8089