Get the .NET TU example to run on a test setup on a local machine

 

​​​Preconditions
  • Visual Studio 2012
  • SQL Server Express 2012
  • .Net Framework 4.0
  • Company / developer have access to the test environment
  • Access through company's firewall (Can be verified by running the test tool in the OOAPI project)
  • Access through Nets DanID firewal (Can be verified by running the test tool in the OOAPI project)
  • Company / developer have a test VOCES certificate and issued to a .pkcs12 file.
  • Latest Java Runtime. Can be downloaded here
     

Walkthrough

 
1. Download the latest .net source and unzip it. This is found in Code (Kildekode).

 

2. Open the project in Visual Studio (ooapi.net.sln)

1.jpg 

 

3. Install the RSA key
Install the RSA key by running following command from the prompt on your machine:
c:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -pi tuexampleKeys C:\tu-key.xml
Notice that the RSA key file TU-key.xml can be found right next to the TUExample.net-source.zip that you downloaded.
 
4. Set the path for the company test certificate (bundled with this application)
This certificate is used to sign NemID client parameters and to call the PID/CPR webservice. It is located in the \tuexample.net\certificates folder.
When you get the test company certificate (test VOCES) it will most likely be a pkcs12 file. To replace the DanID test certificate just rename the certificate file extension to .pfx.
Browse and look in web.config for <add key="pfxFile" and change the physical path to correspond to where the DanID Test certificate is located on your installation.
Browse and look in app.config(ooapi) for <add key="pfxFile" and change the physical path to correspond to where the DanID Test certificate is located on your installation.

To run unittests for ooapi also set <add key="pfxFile" in app.config in the test.ooapi project.

2.jpg 

 

5. Verify access to the DanID test environment (remember to register for access before running the tests)
Run the OOAPI.net subproject from Visual Studio to verify system access.

3.jpg 

 

Choose 9 to connect to the Preprod test environment.

Follow the instructions in the DOS shell, and verify that all tests are compeleted succesfully.
   
6. Run TU-example project
Run the TU-example project and verify that it works.

The webpage should be displayed in your preferred browser as below.

4.jpg 

 

If any errors occur, check for help in the FAQ for developers (in Danish).
   
7. Create test identity in Developers
To test your implementation, you need test users that correspond to different user scenarios. You find guidelines for test in Documentation.

https://appletk.danid.dk/developers/

  
8. Test TU-example
Click Prøv demo on the TU-variant 01 tab.
Click Login ind med nøglekort.

5.jpg 

After a successful login, the following page should be displayed.

6.jpg 

 

9. Test access to PID/CPR service
Test call to PID/CPR service at this URL: http://localhost:[valid port number]/extras/checkPID.aspx.
Get the port number from your local installation.

7.jpg 

 Type in valid PID data from newly created test identity, and verify by clicking Check PID.
This should produce the following page.

8.jpg 

Now check invalid PID/CPR data by inserting invalid data and click Check PID.
This should produce the following page.

9.jpg 

 

10. Change DanID certificate to your own test VOCES certificate
Change the following in the APP.config file of the TU example.
   
Set password for the new test certificate.
Refer to the new certificate on the file system. Note that this certificate file should be in the .pfx file format. If the file extension is .pkcs12 simply rename it to .pfx.

10.jpg 

Change the following in the WEB.config file of the TU example.
 
Set password for the test certificate.
Refer to the new certificate on the file system. Note that this certificate file should be in the .pfx file format. If the file extension is .pkcs12 simply rename it to .pfx.
Change the SPID.

11.jpg 

Remember to change logonto parameter from DanID Test TU to your friendlyname. The friendly name was chosen by you upon requesting access to DanID's test environment.
 
11. Run/test TU-example project
Run/test the TU-example project again to verify that it works with your own certificate and friendlyname.​