IIS 7.5+ | Windows Authentication

We decided to retire one of our Windows 2008 (32-Bit) servers, hosting multiple classic ASP intranet applications. Our immediate choice was another VM, that runs Windows 2008 R2, 64-Bit OS with IIS 7.5.x as intermediatory until we setup a brand new VM running Windows 2019 & soon realized that we were in tight spot as any attempt to access intranet application(s) from the new host started prompting for authorization for applications that were using “Windows Authentication”. All our application servers are domain members, so are our clients.

We did an apple to apple comparison between servers/IIS setup, visited dozens of threads & yet were unable to fix the “problem”, that was the site/application asking for authentication for a user who is already authenticated by the Active Directory!

Credits:

Although Midas site article Configuring Web Browsers for Active Directory Integration | MIDAS clearly mentioned about adding the website to local intranet zone, we missed it completely!

After referring third link, had the answer to our problem. Actually, if a client wants to negotiate authentication using “Windows Authentication” through a website by passing currently logged in user credentials, that website should be in Local Intranet zone, which was, for us controlled using a Group policy. This is strictly to make sure that user details are not shared with Internet zones, as a security measure.

Once the new site name was added to the zone list and group policies updated, we were able to access the intranet applications without further issues.

Classic ASP with Oracle database 12c 64Bit

Hi guys

Yesterday I was contacted by one of the visitors after referring my posts about Classic ASP connection to Oracle databases in general & I revisited this “area” after a long time. It took a while for me to setup everything, however the results were pretty awesome. So here comes one more post about Classic ASP with Oracle database, this time Oracle 12c 64Bit.

OS: Windows 10/64Bit Windows Server OS

Prerequisites

  • Setup IIS for publish classic ASP with Oracle 12c database

Software requirement(s):

  • Oracle client 32Bit, 12c (for best connectivity)

Launch IIS and create a new application pool, as shown with the image.

clip_image002

Now go to the advanced settings for the application pool that you have created & switch “Enable 32-Bit Applications” from “false” to “True”

clip_image004

Connection possibilities

There are two ways to connect to Oracle database from Classic ASP

  1. Using DSN (Data Source Name)
  2. DSN less connections. Here we will use the Oracle tnsnames.ora file to identify and connect to the database. We have to insure that the TNS_HOME directory is set at the environment level, or the client that is used is 1st entry in the environment variable “PATH” for Oracle products in case of multi Oracle homed hosts.

Create a DSN

Classic ASP could interact with only 32Bit environment, hence the IIS server hosting machine must have the latest Oracle 32-Bit client installed (older clients may not connect to later databases properly). As I am writing this post, Oracle 12c 12.2.0 is the latest client available.

Logged with an account having “Administrator” privileges, Open ODBC Data Source (32-bit)

clip_image005

Please note, my box has multiple Oracle products, hence don’t get confused by the names in next few screens.

clip_image007

If your installation for the Oracle client was correct, you should able to see an entry for the Oracle driver like the one you could see the image above.

Click “Finish”. This will pop up another window. Under the “System DSN” tab we have to create our new DSN

clip_image008

Provide a name of your choice for the “Data Source Name” and “Description”

Make sure you have the “TNS Service Name” already available with the listener.ora file. Oracle 12c passwords are case sensitive. Hence make sure you are going to provide the case sensitive password while testing the connection.

If you don’t have previous experiences with creating net service names, please follow the instructions below.

clip_image009

Start “Net Configuration Assistant” from the Oracle Home and follow the images below.

clip_image010

Read the help texts available, especially if you are new to Oracle

clip_image011

Provide the service name, which is your database name usually.

clip_image012
clip_image013

Provide the FQDN (fully qualified domain name), ie, your computer name like “rajesh-pc.abc.com” in case if you are connected to a domain, else just the name of your computer, like “rajesh-pc”

clip_image014

I would suggest doing a test, if you are sure that all the details provided are correct & no need to test, you can skip this step

clip_image015
clip_image016

By default the configuration tool would suggest you the Oracle service name as new net service name, which you can change to any name. Just make sure that you will remember it.

clip_image017
clip_image018

Now let us test the new service name we have just created.

clip_image019

Once the Net Service Name is created, we will see both the scenarios using 2 different asp files, both using different connection approaches

(ASP sample was copied from here)

1. Connecting to 12c using DSN

<html>
<head>
<title>Connecting to an Oracle database using ODBC and DSN connection</title>
</head>
<body>
<%
SET myConn=SERVER.createobject("adodb.connection")
myConn.Open "DSN=BAC;" & _
"Uid=APPS;" & "Pwd=APPS"
SQLStr="SELECT BANK_ID, BANK_NAME, BANK_TYPE FROM BAC_BANKS"
SET result=adoCon.execute(SQLStr)
IF NOT result.EOF thEN
response.write("<h2>Oracle ASP Example</h2>")
response.write("<p>Connecting to the Oracle11g database using ODBC & without a DSN</p>")
response.write("<table BORDER=3 BGCOLOR=#0099CC><tr><th>BANK ID</th>" & _
"<th>Name</th><th>TYPE</th>")
WHILE NOT result.EOF
response.write("<tr><td>" & result("BANK_ID") & "</td>")
response.write("<td>" & result("BANK_NAME") & "</td>")
response.write("<td>" & result("BANK_TYPE") & "</td></tr>")
result.movenext()
WEND
response.write("</table>")
ELSE
response.write("<p>Error retrieving bank data!!</p>")
END IF
adoCon.Close()
%>
</body>
</html>

2. Connecting to 12c without DSN

<%
Dim adoCon 'Holds Connection
Dim rsViewRecords 'Holds Record Set

'Initiate connection

Set adoCon = Server.CreateObject("ADODB.Connection")

adoCon.Open "provider=oraoledb.oracle;data source=SCT;user id=APPS;password=APPS"

if Err.Number <> 0 then
Response.Clear()
response.Write "<hr>ORASESSION Error<br>" & err.number & " — " & err.Description & "<hr>"
response.End
end if

SQLStr="SELECT BANK_ID, BANK_NAME, BANK_TYPE FROM BAC_BANKS"
SET result=adoCon.execute(SQLStr)
IF NOT result.EOF thEN
response.write("<h2>Oracle ASP Example</h2>")
response.write("<p>Connecting to the Oracle11g database using ODBC & without a DSN</p>")
response.write("<table BORDER=3 BGCOLOR=#0099CC><tr><th>BANK ID</th>" & _
"<th>Name</th><th>TYPE</th>")
WHILE NOT result.EOF
response.write("<tr><td>" & result("BANK_ID") & "</td>")
response.write("<td>" & result("BANK_NAME") & "</td>")
response.write("<td>" & result("BANK_TYPE") & "</td></tr>")
result.movenext()
WEND
response.write("</table>")
ELSE
response.write("<p>Error retrieving bank data!!</p>")
END IF
adoCon.Close()
%>

Hope this helps few “Classic ASP” guys out there ;)

regards,

rajesh

Windows 7 64bit, Classic ASP, Visual Studio connection to Oracle Database

References

26.12.2013 Update

We realized, over a 64bit OS you may need to change the default application pool to accommodate 32bit applications. Please refer to this post

https://help.webcontrolcenter.com/KB/a1114/how-to-enable-32-bit-application-pool-iis-7-dedicatedvps.aspx

 

 

http://www.connectionstrings.com/

http://stackoverflow.com/questions/234657/binding-asp-net-gridview-to-an-oracle-sys-refcursor

So, you are still using classic ASP or develop 32bit .NET applications using Visual Studio and Oracle databases on a Windows 7 64bit box and completely lost as connection cannot be established?

Here are few workaround solutions

Install the latest Oracle clients (both 64bit and 32bit)

If you installed Oracle client in the following folders (example)

D:\app\yourusername\product

right click on the folder, under security tab check whether authenticated users have read privileges.

If not, provide the basic privileges (Read & Execute, list folder contents, Read) Refer the image

image

Now add the user “IIS_ISURS” user and provide the same rights mentioned above

RESTART your Windows 7 “64bit” box now!

You can establish the connection from classic ASP like following

<%
    Dim adoCon                'Holds Connection
    Dim rsViewRecords        'Holds Recordset

    Set adoCon = Server.CreateObject("ADODB.Connection")
    if Err.Number <> 0 then 
        Response.Clear() 
        response.Write "<hr>ORASESSION Error<br>" & err.number & "  --  " & err.Description & "<hr>"
        response.End
    end if 

    adoCon.Open "provider=oraoledb.oracle;data source=test;user id=apps;password=apps;plsqlrset=true"

    Set rsViewRecords = Server.CreateObject("ADODB.Recordset")

    %>

 

Regards,

Admin