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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:10:52+00:00 2026-05-25T23:10:52+00:00

I have a RESTful API created with ASP.NET MVC2 that returns all data as

  • 0

I have a RESTful API created with ASP.NET MVC2 that returns all data as XML:

string xml = Serialize(Data, context, AcceptCharsetList, encoding);
context.HttpContext.Response.ContentEncoding = encoding;
context.HttpContext.Response.Charset = encoding.WebName;
context.HttpContext.Response.ContentType = "application/xml";
context.HttpContext.Response.Write(xml);

On my localhost that works fine for both normal responses (model + view) and for errors (error model + error view + http status code).

But on the actual web server only normal requests return xml. For errors it does not work, and the error is served as html with content type = text/html.

My localhost is 64 bit windows 7 with IIS 7.5 and my web server is windows 2008 64 bit with IIS 7.5

What could be wrong?

The expected XML is this:

<?xml version="1.0"?>
<Error xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
 xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
 xmlns="http://api.example.com/">
  <Description>(403) Forbidden.</Description>
</Error>

But it is returning this HTML instead on the web server:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
<title>403 - Forbidden: Access is denied.</title>
</head>
<body>
<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>403 - Forbidden: Access is denied.</h2>
  <h3>You do not have permission to view this directory or page using the 
  credentials that you supplied.</h3>
 </fieldset></div>
</div>
</body>
</html>
  • 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-25T23:10:52+00:00Added an answer on May 25, 2026 at 11:10 pm

    It looks like IIS is returning it’s own error pages. In IIS Manager, navigate to your application, and in the Features view, look at the Error Pages under the IIS section (not the ASP.NET section).

    This blog post looks like it is discussing the same problem, and the author uses the HttpResponse.TrySkipIisCustomErrors property to handle it. I’m not sure if this is applicable in your situation – hopefully it is.

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

Sidebar

Related Questions

I have created a rails application that has a simple RESTful json API. This
I want to add user authentication to my restful api that I have created
I'm using WCF Data Services for a RESTful API that returns a JSON response.
I have a RESTful API containing a URI of /UserService/Register. /UserService/Register takes an XML
Consider following scenario: I have RESTful URL /articles that returns list of articles user
We have a RESTful API that we are doing in MVC3. We would like
I'm using ASP.NET with C# 2.0. I have created some objects for a database
I've created a RESTful API that supports GET/POST/PUT/DELETE requests. Now I want my API
I'm looking for examples of how others have created a RESTful service that supports
I am trying out a RESTful API that has OAuth. I have the API

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.