Protected Sub Page_Load(ByVal
sender As Object,
ByVal e As
System.EventArgs) Handles Me.Load
Dim a =
Server.CreateObject("Scripting.FileSystemObject")
Dim
MyFile = a.CreateTextFile("e:\testfile.txt",
True)
MyFile.WriteLine("This is a test.")
MyFile.Close()
End Sub
But this solution is easy if your target language is VB.NET as it supports late binding. And also C# 4.0 supports late binding using keyword (dynamic). But if we want to achieve same in rest of C# versions (1.1,2.0,3.0), we need to write lengthy code using reflection.