# Re net::http and htaccess

**URL:** <https://www.ruby-forum.com/t/re-net-http-and-htaccess/95794>\
**Category:** Ruby\
**Created:** [June 13, 2006, 9:07pm UTC](https://www.ruby-forum.com/t/re-net-http-and-htaccess/95794 "2006-06-13T21:07:53Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![beachguy82](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/9dc877/32.png) [@beachguy82](https://www.ruby-forum.com/u/beachguy82)\
**Post date:** [June 13, 2006, 9:07pm UTC](https://www.ruby-forum.com/t/re-net-http-and-htaccess/95794/1 "2006-06-13T21:07:53Z")

</div>

I should of googled authentication instead of htaccess. Sorry for the  
noise. Here is the solution

Basic Authentication

```
require 'net/http'

Net::HTTP.start('www.example.com') {|http|
  req = Net::HTTP::Get.new('/secret-page.html')
  req.basic_auth 'account', 'password'
  response = http.request(req)
  print response.body
}

```

Charlie B.  
[http://www.recentrambles.com](http://www.recentrambles.com)
