How to implement Basic Authentication support in BizTalk RosettaNet RNIFSend web page

 

Problem Description

 

==================

 

Some RosettaNet user’s trading partner’s
web site requires HTTPS + Basic Authentication. In this case, they have to
customize the default RNIFSend web page to support Basic Authentication.

 

 

Problem Resolution

 

==================

 

1.Add the
following code to CreateOuterHttpRequest method of RNIFSend.aspx.cs in
RosettaNet SDK.

 

request.PreAuthenticate
= true;

 

string username
= System.Configuration.ConfigurationManager.AppSettings["BasicAuthUsername"];

string password
= System.Configuration.ConfigurationManager.AppSettings["BasicAuthPassword"];

 

NetworkCredential
credential = new NetworkCredential(username,
password);

CredentialCache
credentialCache = new CredentialCache();

credentialCache.Add(url,
"Basic", credential);

 

request.Credentials
= credentialCache;

        

 

2.Modify the
first line of RNIFSend.aspx as:

 

<%@ Page
language="c#" CodeFile="RNIFSend.aspx.cs"
AutoEventWireup="false"
Inherits="Microsoft.Solutions.BTARN.RNIFSend.RNIFSend" %>

 

3.Add the following section to web.config.

 

               
<appSettings>

                               
<add key="BasicAuthUsername" value="Administrator"/>

                               
<add key="BasicAuthPassword" value="Password01!"/>

               
</appSettings>

 

4. Compile the web page and use the
following steps to deploy:

- Create a new virtual directory on IIS for customized RNIFSend page.

Configure the vdir to use  
BTARNAppPool application pool.
  • Copy all files(RNIFSend page,
    Web.config and the Bin folder) to physical path of the new created vdir.
  • Set BasicAuthUsername and
    BasicAuthPassword in Web.config.
  • Change BizTalk send port of the
    partner from using default RNIFSend page’s url to new url of the vdir.

 

Thanks,

WenJun Zhang