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 5943309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:22:37+00:00 2026-05-22T16:22:37+00:00

I’m creating a locking mechanism for some public pages that should only allow one

  • 0

I’m creating a locking mechanism for some public pages that should only allow one user to edit them at the same time. The client makes GET API calls to the server requesting a lock, which returns an MVC ActionResult object. For some reason, when I’m running the program locally and I return a new HttpConflictResult("Cannot acquire lock", message); (indicating that acquiring the lock failed), it works fine. The error message is sent and received properly and can be displayed in an alert or whatever is needed. However, when I’m accessing the site remotely, the message is overwritten with “The page was not displayed because there was a conflict.” Am I doing something wrong or is this a ‘Feature’ of IIS or something? If it is, is there a way around it so that I can still get the message that I want to the client?

Thanks in advance for any help!

EDIT: Sorry, forgot that HttpConflictResult was an inherited class. Here’s some info on it:

public class HttpConflictResult : HttpErrorResult
{
    public HttpConflictResult() : this(string.Empty) { }
    public HttpConflictResult(string errorMessageResource) : this("Conflict", errorMessageResource, true) { }
    public HttpConflictResult(string statusMessage, string errorMessage) :
        base(409, statusMessage, errorMessage) { }
}

public class HttpErrorResult : ActionResult
{
    protected int _statusCode;
    protected string _statusMessage;
    protected string _errorMessage;

    public HttpErrorResult(int statusCode, string statusMessage, string errorMessageResource)
    {
        _statusCode = statusCode;
        _statusMessage = statusMessage;
        _errorMessage = errorMessage;
    }

    public override void ExecuteResult(ControllerContext context)
    {
        context.HttpContext.Response.StatusCode = _statusCode;
        context.HttpContext.Response.StatusDescription = _statusMessage;
        if(_errorMessage != null)
        {
            context.HttpContext.Response.ContentType = "application/json; charset=utf-8";
            context.HttpContext.Response.Clear();

            System.Web.Script.Serialization.JavaScriptSerializer ser = new System.Web.Script.Serialization.JavaScriptSerializer();
            context.HttpContext.Response.Write(ser.Serialize(new { message = _errorMessage }));
        }
    }
}

Let me know if I left anything else out. Thanks again!

  • 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-22T16:22:37+00:00Added an answer on May 22, 2026 at 4:22 pm

    If you’re setting error codes (i.e. http status codes in the 4xx or 5xx ranges), and you’re running under IIS 7, then you need to ensure you’ve told IIS not to use the standard error messages.

    You do this with the TrySkipIisCustomErrors parameter on the Response object. Try modifying your HttpErrorResult as follows:

    public override void ExecuteResult(ControllerContext context)
    {
        // Set TrySkipIisCustomErrors to ensure ASP.NET sends your error content to the
        // user instead of the default ASP.NET content under IIS 7.
        context.HttpContext.Response.TrySkipIisCustomErrors = true;
    
        context.HttpContext.Response.StatusCode = _statusCode;
        context.HttpContext.Response.StatusDescription = _statusMessage;
    
        if(_errorMessage != null)
        {
            [...]
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
Configuring TinyMCE to allow for tags, based on a customer requirement. My config is
I need to clean up various Word 'smart' characters in user input, including but

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.