Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7901619
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:16:10+00:00 2026-06-03T09:16:10+00:00

http://ruby-doc.org/stdlib-1.8.7/libdoc/net/http/rdoc/Net/HTTP.html After reading the doc very carefully, I’m writing the following code snippet for

  • 0

http://ruby-doc.org/stdlib-1.8.7/libdoc/net/http/rdoc/Net/HTTP.html

After reading the doc very carefully, I’m writing the following code snippet for the autologin feature of my program:

url = URI.parse('http://localhost/login.aspx')
req = Net::HTTP::Post.new(url.path)
req.basic_auth 'username'

The target page asks only the correct user name, no password is needed in order to login, the basic_auth method requires two parameters, user name and password, if I leave one out, I’ll get the error, I tried to write it like this “req.basic_auth ‘username‘, ””, but I still cannot login.

Could anyone kindly give me a hint?

more info:
I also tried req.basic_auth ‘username’, ”, it didn’t seem to be working, I know this because there’s another line of line follow right after this one, which is basically doing auto form submission.
x = Net::HTTP.post_form(URI.parse(“http://localhost/NewTask.aspx”), params)
puts x.body

And the puts result came back with the redirect to login page body.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T09:16:11+00:00Added an answer on June 3, 2026 at 9:16 am

    You can consider using ruby mechanize gem. a login example will be much simpler(from official site), for this one, you will not need to do the agent cert and private key thing:

    require 'rubygems'
    require 'mechanize'
    
    # create Mechanize instance
    agent = Mechanize.new
    
    # set the path of the certificate file
    agent.cert = 'example.cer'
    
    # set the path of the private key file
    agent.key = 'example.key'
    
    # get the login form & fill it out with the username/password
    login_form = agent.get("http://example.com/login_page").form('Login')
    login_form.Userid = 'TestUser'
    login_form.Password = 'TestPassword'
    
    # submit login form
    agent.submit(login_form, login_form.buttons.first)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using http://ruby-doc.org/stdlib/libdoc/net/imap/rdoc/index.html to access gmail. I can search for emails with a particular
The benchmark takes a block and returns the time: http://ruby-doc.org/stdlib-1.9.3/libdoc/benchmark/rdoc/Benchmark.html require 'benchmark' puts Benchmark.measure
In the Ruby Standard Library we have the Singleton class: http://ruby-doc.org/stdlib/libdoc/singleton/rdoc/index.html We can make
Using http://ruby-doc.org/stdlib/libdoc/win32ole/rdoc/classes/WIN32OLE.html as a guide I have written the following: require 'win32ole' excel =
I'm trying to run the DelegateClass example from http://ruby-doc.org/stdlib/libdoc/delegate/rdoc/files/delegate_rb.html Here is the code: require
Ruby Net::IMAP library provides a good API for IMAP stuff ( http://railsapi.com/doc/ruby-v1.8/classes/Net/IMAP.html ). There
I'm trying to create a hash from an array and the documentation for http://ruby-doc.org/ruby-1.9/classes/Array.src/M000744.html
I'm looking at ruby's replace: http://www.ruby-doc.org/core/classes/String.html#M001144 It doesn't seem to make sense to me,
From the libxml-ruby API docs ( http://libxml.rubyforge.org/rdoc/index.html ), under LibXML::XML::Document, I tried the following:
In Python I can use scipy.io.loadmat ( http://docs.scipy.org/doc/scipy/reference/generated/scipy.io.loadmat.html ) to load/import MATLAB mat files,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.