On Mon, 2 Jun 2003, Jody Belka wrote:

> IMAP HILLWAY\ said:
> >
> > Now... this works fine for almost every URL I can think of apart from 2:
> > http://www.acxiom.co.uk & http://www.acxiom.com
> > These 2 both return "500 Internal Server Error" but work fine if you go
> > to them with a browser!
>
> bit of checking and it seems that they're using the Accept-Language
> header, and don't imagine you might not send it. if you add that to the
> request (a simple en or en-us will do the trick) then things work
> properly. really bad form on their side of course.
>

As I suspected - if you were on the local machine you would have seen a
stack trace like:

[NullReferenceException]: Object reference not set to an instance of an
object.
   at LangTest.WebForm1.Page_Load(Object sender, EventArgs e) in
c:\inetpub\wwwroot\langtest\webform1.aspx.cs:line 24
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain()
[HttpUnhandledException]: Exception of type
System.Web.HttpUnhandledException was thrown.
   at System.Web.UI.Page.HandleError(Exception e)
   at System.Web.UI.Page.ProcessRequestMain()
   at System.Web.UI.Page.ProcessRequest()
   at System.Web.UI.Page.ProcessRequest(HttpContext context)
   at
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
   at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously)


They will be using the array returned by System.Web.Request.UserLanguages
without checking it.

This of course would be simply fixed with some code like:

   string bestlanguage = "en-gb";
   string[] userLang = Request.UserLanguages;

  if ( userLang != null )
  {
     bestlanguage = userLang[0];
  }

  ....

If someone from the company concerned is reading my consulting rates are
reasonable ;-)

/J\





Reply via email to