Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3240214
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:03:35+00:00 2026-05-17T18:03:35+00:00

We are using the approach described here to log our webservice errors with Elmah.

  • 0

We are using the approach described here to log our webservice errors with Elmah. And this actually works, but sadly the username beeing logged is empty.

We did some debugging and found, that when logging the error in the ErrorHandler the HttpContext.Current.User has the correct User set.

We also tried:

HttpContext context = HttpContext.Current;
ErrorLog.GetDefault(context).Log(new Error(pError, context));

and

ErrorLog.GetDefault(null).Log(new Error(pError));

Without success.

Any ideas on how we can make Elmah log the username?

On a sidenote, when logging the error directly within the Webservice, the username is logged as expected. But taking this approach is not very DRY.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T18:03:36+00:00Added an answer on May 17, 2026 at 6:03 pm

    Elmah take the user from Thread.CurrentPrincipal.Identity.Name and not from HttpContext.Current.User.

    Since there ins’t a convenient way to add custom data to Elmah, I would suggest recompiling the code, and calling HttpContext.Current.User instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Anybody tried here using Getting Real(37Signals) approach to develop windows application? (C#/.NET). Or simply
I'm using Linq to entities applying a Table per Type approach. This has been
Can I use this approach efficiently? using(SqlCommand cmd = new SqlCommand(GetSomething, new SqlConnection(Config.ConnectionString)) {
Using an ORM approach in applications can often lead to the scenario where you
Setting up an integration server, I’m in doubt about the best approach regarding using
Using a web service is often an excellent architectural approach. And, with the advent
Currently I'm using a session-per-request approach to manage Hibernate sessions in a Java web
I'm investigating an annotation-based approach to validating Spring beans using spring modules . In
What would be a better approach to compare two floating point values - using
I'd appreciate some feedback on a particular approach I'm thinking of using. The scenario

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.