tags:

views:

50

answers:

0

Hi all,

I have a aspx webpage which uses an assembly mine (which mades a custom authentification). I would like to modify MSIL code (so just with ILDASM/ILASM tools) of my assembly in order to log something in a file.

I have tried to add this at the end of the authentification method of my assembly :

IL_0034:  ldstr      "C:\\path_to_my_website\\log.txt"
IL_0039:  newobj     instance void [mscorlib]System.IO.StreamWriter::.ctor(string)
IL_003e:  stloc.1
IL_003f:  ldloc.1
IL_0040:  ldstr      "test"
IL_0045:  callvirt   instance void [mscorlib]System.IO.TextWriter::Write(string)
IL_004a:  nop
IL_004b:  ldloc.1
IL_004c:  callvirt   instance void [mscorlib]System.IO.TextWriter::Close()
IL_0051:  nop

ILASM does not find any error, and the CLR does not throw any exception at runtime, but the file is not created or modified ! :(

Any idea ?