This topic is locked

Passing SQL DB information

3/18/2011 12:55:39 PM
ASPRunner.NET General questions
M
Michaelr05 author

Hello,
I need to keep a log file of all transactions in my site. I'll use login as an example:
Login database has these items
UserID

Password

Company
After a successful login (user inputs username and password) i need to create a log entry storing the LoginID, date and company name. I need to pass the company name and userID information (date and time is sinmple) from the login page to the log database.
I guess my 2 questions are:

  1. is there any way to set a session values in ASPRunner.Net project file or where can I set it manually in the files
  2. I can pass the username and company ID to the called procedure in the Events.cs file but I need to manually script it and manually change the entry in the Login.aspx.cs page also.
    CEvents
    public static void AfterSuccessfulLogin(System.Web.UI.Page Page, string UserName, string Company)

    Data.D_Log item = null;

    item = new Data.D_Log();

    item.D_UserID = UserName;

    item.D_Company = Company;

    item.D_Action = "Login";

    item.D_dateLog = (DateTime.Now);

    item.Save();
    I can do it manually but then everytime I recompile, I will need to reapply the manual changes every time.
    Is there any way I can use ASPRunner.net and set them in the project so everytime I recompile, these a=chanes aren't lost.
    Thanks for the help and any idea when an updated copy will be coming out?
    Rizzy

Sergey Kornilov admin 3/27/2011

In regards to setting Session variables - AfterSuccessfulLogin event is the best place to populate session variables.
In regards to passing additional parameters you have two choices:

  1. Either move your code that retrieves CompanyID right to AfterSuccessfulLogin event
  2. Or modify source files in C:\Program Files\ASPRunner.NET5.0\source to extend AfterSuccessfulLogin definition. You can find it in commonevents.cs and in login.aspx.cs file. Please note that ASPRunner.NET source code is implemented in C# and auto-converted to VB.NET during the build process.