# IIS, Net::HTTP::Get, and Basic Authentication

**URL:** <https://www.ruby-forum.com/t/iis-net-get-and-basic-authentication/168883>\
**Category:** Rails\
**Created:** [May 27, 2009, 1:32am UTC](https://www.ruby-forum.com/t/iis-net-get-and-basic-authentication/168883 "2009-05-27T01:32:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![BenH](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8baadc/32.png) [@BenH](https://www.ruby-forum.com/u/BenH)\
**Post date:** [May 27, 2009, 1:32am UTC](https://www.ruby-forum.com/t/iis-net-get-and-basic-authentication/168883/1 "2009-05-27T01:32:24Z")

</div>

I’m getting a 401.2 from IIS  
You do not have permission to view this directory or page using the  
credentials that you supplied because your Web browser is sending a  
WWW-Authenticate header field that the Web server is not configured to  
accept.  
The sysadmin says that basic auth is enabled. Is there something  
special about how rails handles basic auth? Is there a way for me to  
see what the server actually gets and what the headers say is  
acceptable?

My Code:  
def get\_wsdl(url=nil)  
return false if url.nil?  
url = URI.parse(url) unless url.is\_a?(URI)

```
connection = Net::HTTP.new(url.host, url.port)
connection.use_ssl = true
connection.verify_mode = OpenSSL::SSL::VERIFY_NONE

connection.start do |http|
  req = Net::HTTP::Get.new("#{url.path}?#{url.query}")
  req.basic_auth 'username','password'
  puts http.request(req).body
end

```

end
