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

  • Home
  • SEARCH
  • 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 8868531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T17:17:40+00:00 2026-06-14T17:17:40+00:00

I am getting my elmah error log filled with exception: Server cannot set status

  • 0

I am getting my elmah error log filled with exception:

Server cannot set status after HTTP headers have been sent.

70% of those requests are caused by crawlers(alexa,googlebot), and I can’t guarantee that the rest of requests aren’t bots with fake cookies, agent strings etc. but some of those requests really seem legit.

Here is Facebook authorization method where error occures:

  public class FacebookClient : WebServerClient 
    {
        private static readonly AuthorizationServerDescription FacebookDescription = new AuthorizationServerDescription 
        {
            TokenEndpoint = new Uri("https://graph.facebook.com/oauth/access_token"),
            AuthorizationEndpoint = new Uri("https://graph.facebook.com/oauth/authorize"),
        };

        /// <summary>
        /// Initializes a new instance of the <see cref="FacebookClient"/> class.
        /// </summary>
        public FacebookClient() : base(FacebookDescription) 
        {
        }
    }

 private static readonly FacebookClient client = new FacebookClient
    {
        ClientIdentifier = ConfigurationManager.AppSettings["facebookAppID"],

        ClientCredentialApplicator = ClientCredentialApplicator.PostParameter(ConfigurationManager.AppSettings["facebookAppSecret"]),
    };

    [AllowAnonymous]
    public ActionResult Facebook(string returnUrl)
    {
        IAuthorizationState authorization = client.ProcessUserAuthorization();

        if (authorization == null)
        {
            var scope = new List<string>();

            scope.Add("email");

            client.RequestUserAuthorization(scope);
        }
        else
        {
            try
            {
                var request = WebRequest.Create("https://graph.facebook.com/me?&access_token=" + Uri.EscapeDataString(authorization.AccessToken));

                using (var response = request.GetResponse())

                using (var responseStream = response.GetResponseStream())
                {
                    var graph = FacebookGraph.Deserialize(responseStream);

                    if (Membership.GetUser(graph.Id.ToString()) == null)
                    {
                        MembershipCreateStatus membershipCreateStatus = MembershipCreateStatus.Success;

                        var user = Common.CreateUser(membershipCreateStatus, graph.Id.ToString(), HttpUtility.HtmlEncode(graph.Email));

                        if (membershipCreateStatus != MembershipCreateStatus.Success)
                        {
                            TempData["message"] = "Unsuccessful creation of Account. " + membershipCreateStatus.ToString();

                            return RedirectToAction("Login", "Account");
                        }

                        if (membershipCreateStatus == MembershipCreateStatus.Success)
                        {

                            AddUserShortID((Guid)user.ProviderUserKey, HttpUtility.HtmlEncode(graph.Name));

                            Common.Authorize(graph.Id.ToString());
                        }
                    }
                    else
                    {
                        Common.Authorize(graph.Id.ToString());
                    }
                }
            }
            catch
            {
                TempData["message"] = "Unsuccessful creation of Account. ";

                return RedirectToAction("Login", "Account");
            }
        }

        if (!string.IsNullOrWhiteSpace(returnUrl) && Url.IsLocalUrl(returnUrl))
        {
            return Redirect(returnUrl);
        }

        return RedirectToAction("Index", "Home");
    }

What is the most suspicious part of code here which may cause this kind of behaviour? Why does this happens most of the time with bots? Is there any way to reproduce something like this?

UPDATE: This is not just caused by bots I got this exception yesterday also, well only in log, in browser I got not found graph.facebook.com/…

  • 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-06-14T17:17:41+00:00Added an answer on June 14, 2026 at 5:17 pm

    I discovered when this exception happens, when I get redirected to Facebook login page, if you refresh the page or enter login info wrong, or if the page is not currently available for whatever reason this exception gets logged but the most important thing is that user will not see anything unusual happening, or have any problems logging in.

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

Sidebar

Related Questions

Getting the following error: "Warning: Cannot modify header information - headers already sent by
I'am getting sometimes the following error on my published web app with ELMAH: System.Web.HttpException
I tried this solution with Elmah.XmlFileErrorLog but I'm getting following exception System.ArgumentNullException was unhandled
Getting: An error has occurred: Error connecting to the server: fe_sendauth: no password supplied
Getting the following error/exception while trying to compile my maven based web application... can
I'm trying to deploy elmah . For inexplicable reasons, I'm getting an error: .axd
I'm getting a strange error in my MVC site. I have an action in
Getting this error when I successfully log in with passport JS. Trying to redirect
I am having some trouble getting Elmah to work with url routing in an
Getting extremely confused with an adminhtml module i'm trying to write! Effectively I have

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.