I have 2 RAZOR Index forms in my application. 1 Form creates records in one database "LocalDB" and updates the same record in another database "Core DB". Another Form sync records from "CoreDB" to "LocalDB". Have to do this because there are other applications who creates records into "CoreDB". In my local db, I am keeping the audit trail by 4 columns. CreateAt, CreatedBy, ModifiedAt, ModifiedBy. These columns give me info about who created/modified record and at what time.
I have a simple static class with a static function where I am getting the current user loged into my web application as
currentUser = HttpContext.Current.User.Identity.Name;
This works when i user Form 1 where i create records. When i use the Form 2, where trying to Sync record from COREDB to LocalDB, this same line throws null exception.
Can you please advice why this is happening?
Thanks!