Mechanize and NTLM Authentication

前端 未结 2 1833
梦谈多话
梦谈多话 2021-01-16 11:21

The following code generates a 401 => Net::HTTPUnauthorized error.

From the log:


response-header: x-powered-by => ASP.NET
response-header: content         


        
相关标签:
2条回答
  • 2021-01-16 12:01

    Mechanize 2 supports NTLM auth:

    m = Mechanize.new
    m.agent.username = 'user'
    m.agent.password = 'password'
    m.agent.domain = 'addomain'
    
    0 讨论(0)
  • 2021-01-16 12:08
    agent.add_auth('http://server', 'username', 'password', nil, 'domain.name')
    

    http://mechanize.rubyforge.org/Mechanize.html

    tested:

    • Windows Server 2012 R2 + IIS 8.5
    • Ruby 1.9.3
    0 讨论(0)
提交回复
热议问题