IIS Self-signed certificate issue – ‘The Parameter is incorrect’

I experienced the issue today, this is caused because today being a leap year. Set your system time to yesterday/Next day and you will be able to create the cert.

Oracle 8i Installation on Virtual Machine and Windows XP Machine.

Oracle 8i can not be installed on Virtual Machines. Oracle has introduced a patch for the same but it is payable. Also, if you want to install Oracle 8i Enterprise on Windows XP and setup doesn’t start, please follow below steps:

1. Go to path “C:\Oracle 8i Setup\stage\Components\oracle.swd.jre\1.1.7.30\1\DataFiles\Expanded\jre\win32\bin”.

2. Rename “symcjit.dll” to “symcjit_back.dll”.

3. Try to run setup again.

Setup restarts/auto repairs automatically if application makes any change in its folder and if user clicks on application shortcut next time.

Solution to this is to disable auto repair by modifying msi file.

Addthe property DISABLEADVTSHORTCUTS (case sensitive) to the Property table with a value of 1.

Progamatically, you can do the same as below and add post build script.

cscript //nologo "[Path]\UpdateScript.vbs" "$(BuiltOuputPath)" "INSERT INTO Property(Property, Value) VALUES (‘DISABLEADVTSHORTCUTS’, ‘1’)

 

‘ Windows Installer utility to execute SQL statements against an installer database
‘ For use with Windows Scripting Host, CScript.exe or WScript.exe
‘ Copyright (c) 1999-2001, Microsoft Corporation
‘ Demonstrates the script-driven database queries and updates

Option Explicit

Const msiOpenDatabaseModeReadOnly = 0
Const msiOpenDatabaseModeTransact = 1

Dim argNum, argCount:argCount = Wscript.Arguments.Count
If (argCount < 2) Then
    Wscript.Echo "Windows Installer utility to execute SQL queries against an installer database." &_
        vbLf & " The 1st argument specifies the path to the MSI database, relative or full path" &_
        vbLf & " Subsequent arguments specify SQL queries to execute – must be in double quotes" &_
        vbLf & " SELECT queries will display the rows of the result list specified in the query" &_
        vbLf & " Binary data columns selected by a query will not be displayed" &_
        vblf &_
        vblf & "Copyright (C) Microsoft Corporation, 1999-2001.  All rights reserved."
    Wscript.Quit 1
End If

‘ Scan arguments for valid SQL keyword and to determine if any update operations
Dim openMode : openMode = msiOpenDatabaseModeReadOnly
For argNum = 1 To argCount – 1
    Dim keyword : keyword = Wscript.Arguments(argNum)
    Dim keywordLen : keywordLen = InStr(1, keyword, " ", vbTextCompare)
    If (keywordLen) Then keyword = UCase(Left(keyword, keywordLen – 1))
    If InStr(1, "UPDATE INSERT DELETE CREATE ALTER DROP", keyword, vbTextCompare) Then
        openMode = msiOpenDatabaseModeTransact
    ElseIf keyword <> "SELECT" Then
        Fail "Invalid SQL statement type: " & keyword
    End If
Next

‘ Connect to Windows installer object
On Error Resume Next
Dim installer : Set installer = Nothing
Set installer = Wscript.CreateObject("WindowsInstaller.Installer") : CheckError

‘ Open database
Dim databasePath:databasePath = Wscript.Arguments(0)
Dim database : Set database = installer.OpenDatabase(databasePath, openMode) : CheckError

‘ Process SQL statements
Dim query, view, record, message, rowData, columnCount, delim, column
For argNum = 1 To argCount – 1
    query = Wscript.Arguments(argNum)
    Set view = database.OpenView(query) : CheckError
    view.Execute : CheckError
    If Ucase(Left(query, 6)) = "SELECT" Then
        Do
            Set record = view.Fetch
            If record Is Nothing Then Exit Do
            columnCount = record.FieldCount
            rowData = Empty
            delim = "  "
            For column = 1 To columnCount
                If column = columnCount Then delim = vbLf
                rowData = rowData & record.StringData(column) & delim
            Next
            message = message & rowData
        Loop
    End If
Next
If openMode = msiOpenDatabaseModeTransact Then database.Commit
If Not IsEmpty(message) Then Wscript.Echo message
Wscript.Quit 0

Sub CheckError
    Dim message, errRec
    If Err = 0 Then Exit Sub
    message = Err.Source & " " & Hex(Err) & ": " & Err.Description
    If Not installer Is Nothing Then
        Set errRec = installer.LastErrorRecord
        If Not errRec Is Nothing Then message = message & vbLf & errRec.FormatText
    End If
    Fail message
End Sub

Sub Fail(message)
    Wscript.Echo message
    Wscript.Quit 2
End Sub

System.Data.OracleClient not working in 64 bit machines when built in 32 bit machines web setup project with custom action where target platform = x64

The issue is that if you build a managed class library project targeting a 64-bit platform using /platform:x64 or /platform:Itanium and install a Windows Installer package built in Visual Studio 2005 on a 64-bit machine a System.BadImageFormatException is thrown.

When you build the Windows Installer project in Visual Studio 2005 it embeds the 32-bit version of InstallUtilLib.dll into the Binary table as InstallUtil.

To workaround this issue you either need to import the appropriate bitness of InstallUtilLib.dll into the Binary table for the InstallUtil record or – if you do have or will have 32-bit managed custom actions add it as a new record in the Binary table and adjust the CustomAction table to use the 64-bit Binary table record for 64-bit managed custom actions.

To replace the 32-bit InstallUtilLib.dll with the 64-bit bitness,

  1. Open the resulting .msi in Orca from the Windows Installer SDK
  2. Select the Binary table
  3. Double click the cell [Binary Data] for the record InstallUtil
  4. Make sure "Read binary from filename" is selected and click the Browse button
  5. Browse to %WINDIR%\Microsoft.NET\Framework64\v2.0.50727 (if you are on 32 bit, get this dll from 64 bit machine)
  6. Select InstallUtilLib.dll
  7. Click the Open button
  8. Click the OK button

To ignore modifying msi every time, write post build script to web setup project in visual studio. Follow below steps:

1. Create vbscript file as .vbs for script below

Option Explicit
rem ———————————————————–
rem Setup_PostBuildEvent_x64.vbs
rem
rem Patch an msi with the 64bit version of InstallUtilLib.dll
rem to allow x64 built managed CustomActions.
rem ———————————————————–   

Dim releasemode : releasemode = Wscript.Arguments(1)

If releasemode <> "Release64" THEN
    WScript.Echo "You execute a script for 32 bit."
    WScript.quit 0
End If

WScript.Echo "You execute a script, you need to change MSI for compatible 64 bit machine."

Const msiOpenDatabaseModeTransact = 1
Const msiViewModifyAssign         = 3

rem path to the 64bit version of InstallUtilLib.dll
Const INSTALL_UTIL_LIB_PATH = "[Path]\InstallUtilLib.dll"

Dim installer : Set installer = Wscript.CreateObject("WindowsInstaller.Installer")

Dim sqlQuery : sqlQuery = "SELECT `Name`, `Data` FROM Binary"

Dim database
Set database = installer.OpenDatabase(Wscript.Arguments(0), msiOpenDatabaseModeTransact)
Dim view : Set view = database.OpenView(sqlQuery)

Dim record : Set record = installer.CreateRecord(2)
record.StringData(1) = "InstallUtil"
view.Execute record

record.SetStream 2, INSTALL_UTIL_LIB_PATH

view.Modify msiViewModifyAssign, record
database.Commit

Set view = Nothing
Set database = Nothing

2. Write post build script :  wscript.exe "[Path]\Setup_PostBuildEvent_x64.vbs" "$(BuiltOuputPath)" "$(Configuration)"
Note: Create new configuration for 64 bit machine from configuration manager.

Source: http://blogs.msdn.com/b/heaths/archive/2006/02/01/64-bit-managed-custom-actions-with-visual-studio.aspx

Error message when you visit a Web site that is hosted on IIS 7.0: "HTTP Error 500.0 – Internal Server Error"

Server Error in Application "application name"
HTTP Error 500.0 – Internal Server Error
HRESULT: 0x8007000d
Description of HRESULT Handler "ASPClassic" has a bad module "IsapiModule" in its module list

This problem occurs because the ISAPIModule module is missing from the modules list for the Web site. The ISAPIModule module is in the following location: drive:\Windows\System32\inetsrv\isapi.dll

Add the ISAPIModule module to the modules list for the Web site. To do this, follow these steps:

  1. Click Start, click Run, type inetmgr.exe, and then click OK.
  2. In IIS Manager, expand server name, expand Web sites, and then click the Web site that you want to modify.
  3. In Features view, double-click Module.
  4. In the Actions pane, click Add Native Module.
  5. In the Add Native Module dialog box, click to select the IsapiModule check box, and then click OK.

or still if you do not find IsapiModule in the list, you need to to add manually from “Turn Windows Features on/off” from Control Panel > Uninstall Programs and mark

  1. .Net Extensibility
  2. ASP.NET
  3. ISAPI Extensions
  4. ISAPI Filters

from Internet Information Services > World Wide Web Services > Application Development Features.

Source: http://support.microsoft.com/kb/942031

Error message when you try to visit a Web page that is hosted on a computer that is running IIS 7.0: "HTTP Error 404.2 – Not Found"

To resolve this issue, configure the restriction on the ISAPI and CGI Restrictions page to allow the requested ISAPI resource or the requested CGI resource. To do this, follow these steps:

  1. Click Start, type Inetmgr in the Start Search box, and then click Inetmgr in the Programs list.
    If you are prompted for an administrator password or for confirmation, type the password, or click Continue.
  2. Locate the level that you want to configure.
  3. In Features view, double-click ISAPI and CGI Restrictions.
  4. Right-click the restriction that restricts the requested ISAPI resource or the requested CGI resource, and then click Allow.

Source: http://support.microsoft.com/kb/942040

MouseOut and MouseLeave

These are the 2 different events for mouse out. Although they both works same except mouse leave handles event bubbling. I was confused to see that when I have div with nested div(s) inside master div, mouse out event was not working when it hovers nested div. Mouse Leave event handles this problem and works perfectly. I tested on IE 6  too and it works fine.

Web deployement in Visual Studio 2010

  1. New “Publish” menu item on web application project.
    1. Allow developer to directory deploy web application on FTP(s).
    2. New toolbar item to deploy web application, so that developer does not need to open “Publish” window every time.
    3. Web config transformation, allow to have multiple web configs under parent config file. Example:
      1. Web.config
        1. Web.Debug.config
        2. Web.Release.config
    4. Support Database deployment.
    5. New feature “Build Deployment Package”, It will compile your application, perform appropriate web.config transforms on it, optionally create .sql scripts for your database schema and data files, and then package them all up into a .zip deployment package file

Difference between website and web application projects in visual studio 2005+

Website:

  1. It is just a group of all folders and files under one folder.
  2. It has not project file.
  3. Developer has to open existing website by selecting a folder, not just by double clicking.
  4. It has no bin folder.
  5. It build dynamically at runtime.
  6. It can not create single assembly of a website.
  7. Useful when to write a code and to share the same.

Web Application:

  1. It contains a project file where in all files and folders are under it.
  2. It is an old visual studio 2003 style.
  3. All code files are compiled under one directory.
  4. It has several options for publishing.

Tuple – Replacement to temporary Entity classes.

C# 4.0 has introduced Tuple to replace entity classes which we create for temporary purpose to store values when returning from any methods. In general practice, we create entity class containing some properties in it to store values which lets say we store from DAL to return to presentation layer. These classes sometimes are for temporary use and of no use except storing values. Tuple, is really useful to replace such classes. Examples of it are as below:

static void Main(string[] args)
{
            //var t = Tuple.Create<string, int>("Vishal", 29);
            //var t = Tuple.Create("Vishal", 29, new Tuple<string, string>("Rajkot","Gujarat"));

            //It will give compilation error, as Tuple.Create method can only create upto 8 elements.
            //var t = Tuple.Create(1,2,3,4,5,6,7,8,9);

            //It will work because new Tuple<> can create 8 or more elements.
            //var t = Tuple.Create(1, 2, 3, 4, 5, 6, 7, new Tuple<int, int>(8, 9));
            //Console.WriteLine(t);

            //It can access with Item1, Item2, t.Rest.Item1.Item2, etc.
            var t = Tuple.Create(1, 2, 3, 4, 5, 6, 7, new Tuple<int, int>(8, 9));
            Console.WriteLine(t.Rest.Item1.Item2);

            //Console.WriteLine(t);
            Console.Read();
}