0

I have a Sharepoint Visual Web Part frontend to an app I'm writing. That might not be relevant to my problem, because really it seems to me the same problem would apply to any ASP.net application.

The app has a business logic class and a data access class. I'm trying to write to a log file from the business layer, but the issue is that I can't figure out how to grab the username of the Sharepoint user from the business layer. Any ideas?

I'm using C# with .net 3.5 and Visual Studio 2010.

Thanks!!

Michael Nelson
  • 177
  • 1
  • 3
  • 14
  • do you not have a SPWeb object? – Truezplaya Sep 13 '12 at 10:33
  • Yes, in the VWP layer, but not in the business logic layer. The application is broke into tiers. – Michael Nelson Sep 13 '12 at 13:48
  • Can you not pass that object to the business layer? – Truezplaya Sep 14 '12 at 07:24
  • The logging event could happen without (necessarily) a call from the UI layer. I supposed I could expose a "log info" object that I could call from the BL, provided that every UI I build has that same object...? I must be completely confused in my noobness, because it seems to me everyone should have this same problem. I need some "generic" way of picking up a username from any UI associated with the solution... – Michael Nelson Sep 14 '12 at 17:50
  • Where are you trying to log the error to? The wondows log? – Truezplaya Sep 17 '12 at 07:21
  • I don't think that would have any bearing on the problem, but in this case I have a log database. Could as easily be the Windows log, or a text file or anywhere else, though. – Michael Nelson Sep 17 '12 at 14:00

0 Answers0