WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.



Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

iHttpInit and 401 Error

Keywords: 	  iHttpInit  401


In the code:
	;...get the UserID and pw_
	connecthandle=iHostConnect(tophandle, "", @HTTP, UserID, pw_)

	datahandle=iHttpInit(connecthandle, "GET", "/install.exe", "",0)
	rslt=iHttpOpen(datahandle, "", 0, 0) ; error: returns code 401

I'm getting the 401 HTTP response code.

If I change the iHTTPInit to look for the file "" instead, then I get the root level index.html fine. But I am unable to get any other file below it using iHTTPInit. It looks like the server is saying, "sorry you don't have access to this web page".

Does the iHTTPInit function require the userid and password to be passed in the HTTP header block somehow? If HTTP is stateless, how does it know if a client is allowed to have access to a protected page?


  1. I would verify the userid and password being passed into the script.

    Add a

    to your script to make sure the userid/password obtaining process is not broke. Maybe even hard code it in.

  2. The userid and password should be taken care of automagically.

  3. The Browser - or the WinInet extender in this case - send the userid and password with EACH page request. MAKE SURE you can read the page with MSIE 4.0 or newer on the same computer you are having problems with.

    Although the web server is stateless, a series of pages can have states by simply embedding information into the HTML or the users browser. Cookies are common, as well as hidden form variables.

    For example if you go to and do everything except actually buy something, you will notice the URL does not change, but there are obviously states involved.

Article ID:   W14206
Filename:   iHttpInit and 401 Error.txt
File Created: 2017:07:28:13:58:48
Last Updated: 2002:07:15:13:00:17