Hi, I'm a first time poster to this group, hopefully this is the right
place to ask this question.

I have a speech recognition engine that should be executing client side
(in a web browser) after using an activeX control to load data files
from a remote location (i.e my server running IIS).

When the activeX control tries to load files remotely from my server,
it fails with a 406 error. I can manually access the file(s) that fail
to load whenn via my browser...so there is something specific to the
way the ActiveX control is accessing them that is causing the error.

The speech recognizer is not my software; it is a commercial
package...although I am the first consumer of the software (i.e. alpha
version). The deveoper of this software has tested the ActiveX control
on his system which is running Unix and it works properly.

My server is running IIS Version 5.1 on Windows XP Professional with
SP2 and most settings are default. I'm not super experienced with IIS;
any troubleshooting help would be greatly appreciated.

Included below are some of the calls used by the speech recognition
software (not my code) to remotely access files on my server (anything
unusual about these?):

<i>
// Create HTTP request
// verb is NULL, so "GET"
HINTERNET hHttp = HttpOpenRequest(m_hSConnection, NULL,
m_UrlComponents.lpszUrlPath, NULL, NULL, (const char **)mtypes,
dwFlags, 0);

...

// Send HTTP request
BOOL status = HttpSendRequest(hHttp, NULL, 0, NULL, 0);

...

status = InternetReadFile(hHttp, m_DownloadBuf, numToRead, &numRead);
<i>

Thanks!
Jason Schlachter

Re: 406 error when requesting files from my server by Randy

Randy
Mon Nov 27 13:38:38 CST 2006

Jason,

It looks like you need to specify the MIME type:

http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/624fb32a-d0ac-48b1-b6bf-238aa5b4a70a.mspx?mfr=true

"406 Client browser does not accept the MIME type of the requested page."

They should have the details on getting this setup per their application.

HTH
Randy
www.adsi4nt.com


<jason.schlachter@gmail.com> wrote in message
news:1164655360.516572.240050@j44g2000cwa.googlegroups.com...
> Hi, I'm a first time poster to this group, hopefully this is the right
> place to ask this question.
>
> I have a speech recognition engine that should be executing client side
> (in a web browser) after using an activeX control to load data files
> from a remote location (i.e my server running IIS).
>
> When the activeX control tries to load files remotely from my server,
> it fails with a 406 error. I can manually access the file(s) that fail
> to load whenn via my browser...so there is something specific to the
> way the ActiveX control is accessing them that is causing the error.
>
> The speech recognizer is not my software; it is a commercial
> package...although I am the first consumer of the software (i.e. alpha
> version). The deveoper of this software has tested the ActiveX control
> on his system which is running Unix and it works properly.
>
> My server is running IIS Version 5.1 on Windows XP Professional with
> SP2 and most settings are default. I'm not super experienced with IIS;
> any troubleshooting help would be greatly appreciated.
>
> Included below are some of the calls used by the speech recognition
> software (not my code) to remotely access files on my server (anything
> unusual about these?):
>
> <i>
> // Create HTTP request
> // verb is NULL, so "GET"
> HINTERNET hHttp = HttpOpenRequest(m_hSConnection, NULL,
> m_UrlComponents.lpszUrlPath, NULL, NULL, (const char **)mtypes,
> dwFlags, 0);
>
> ...
>
> // Send HTTP request
> BOOL status = HttpSendRequest(hHttp, NULL, 0, NULL, 0);
>
> ...
>
> status = InternetReadFile(hHttp, m_DownloadBuf, numToRead, &numRead);
> <i>
>
> Thanks!
> Jason Schlachter
>



Re: 406 error when requesting files from my server by David

David
Mon Nov 27 18:36:39 CST 2006

HTTP 406 Status code means:
The client failed to send an "Accept:" request header which matches
the "Content-Type:" response header.

In other words, HTTP states that the client has to indicate to the
server the media types that it can handle, via the Accept: header, and
the server should send back the content ONLY if it matches the Accept
header, or 406 error otherwise. This ensures that the server does not
send back content the client is unable to handle.

The problem is with this line of code:
HINTERNET hHttp = HttpOpenRequest(m_hSConnection, NULL,
m_UrlComponents.lpszUrlPath, NULL, NULL, (const char **)mtypes,
dwFlags, 0);

"mtypes" does not include a matching media type for the data files
retrieved from IIS.

For testing purposes, you can set mtypes to */* to indicate your client
accepts anything. You may want to change it to something more specific,
like text/xml, to be correct in accordance to the application's needs.


Web Browsers will send the correct Accept: request header, so that's
why it works.

The Developer targetting Unix is likely using Apache, which follows a
looser interpretation of the HTTP specification in this case. Its
static file handler sends back anything regardless of Accept: , so it
"just works", for better or for worse.

It certainly makes the Developer think the problem is with IIS when in
fact the problem is really with the Developer's code, and Apache's
looseness contributes to the misunderstanding.


//David
http://w3-4u.blogspot.com
http://blogs.msdn.com/David.Wang
//



jason.schlachter@gmail.com wrote:
> Hi, I'm a first time poster to this group, hopefully this is the right
> place to ask this question.
>
> I have a speech recognition engine that should be executing client side
> (in a web browser) after using an activeX control to load data files
> from a remote location (i.e my server running IIS).
>
> When the activeX control tries to load files remotely from my server,
> it fails with a 406 error. I can manually access the file(s) that fail
> to load whenn via my browser...so there is something specific to the
> way the ActiveX control is accessing them that is causing the error.
>
> The speech recognizer is not my software; it is a commercial
> package...although I am the first consumer of the software (i.e. alpha
> version). The deveoper of this software has tested the ActiveX control
> on his system which is running Unix and it works properly.
>
> My server is running IIS Version 5.1 on Windows XP Professional with
> SP2 and most settings are default. I'm not super experienced with IIS;
> any troubleshooting help would be greatly appreciated.
>
> Included below are some of the calls used by the speech recognition
> software (not my code) to remotely access files on my server (anything
> unusual about these?):
>
> <i>
> // Create HTTP request
> // verb is NULL, so "GET"
> HINTERNET hHttp = HttpOpenRequest(m_hSConnection, NULL,
> m_UrlComponents.lpszUrlPath, NULL, NULL, (const char **)mtypes,
> dwFlags, 0);
>
> ...
>
> // Send HTTP request
> BOOL status = HttpSendRequest(hHttp, NULL, 0, NULL, 0);
>
> ...
>
> status = InternetReadFile(hHttp, m_DownloadBuf, numToRead, &numRead);
> <i>
>
> Thanks!
> Jason Schlachter