You can also use pagebehind to accomplish this tusk.
Create a textfile inside your application say "Log.txt";
System
.IO.StreamWriter objWriter;//Declare this as public.
string LOG_FILE_NAME; //Declare this as public.
protected void Page_Load(object sender, EventArgs e)
{
LOG_FILE_NAME = Server.MapPath("Log.txt");
}
string strMessage ="";//put your message here
WriteLogMessage (strMessage);
public void WriteLogMessage(string strMessage)
{
try
{
if (System.IO.File.Exists(LOG_FILE_NAME) == true)
{
objWriter = System.IO.File.AppendText(LOG_FILE_NAME);
}
else
{
objWriter = System.IO.File.CreateText(LOG_FILE_NAME);
}
objWriter.Write(strMessage + Environment.NewLine);
}
catch (Exception ex)
{
}
finally
{
objWriter.Flush();
objWriter.Close();
}
}
Sai_sudha, if this helps please login to Mark As Answer. | Alert Moderator