【问题标题】:How to redirect to home page of Pentaho after basic authentication in .NET?如何在.NET 中进行基本身份验证后重定向到 Pentaho 的主页?
【发布时间】:2013-06-21 02:16:34
【问题描述】:

我尝试在 VB.NET 端使用基本身份验证来登录 Pentaho

我使用 Pentaho 的默认账号进行测试

用户名:joe

密码:密码

我在 VB.NET 中有以下代码用于 Pentaho 的基本身份验证

Dim request = WebRequest.Create("http://x.x.x.x:8080/pentaho/Home")
Dim authInfo As String = Convert.ToString(userName) & ":" & Convert.ToString(userPassword)
authInfo = Convert.ToBase64String(Encoding.[Default].GetBytes(authInfo))
request.Headers("Authorization") = "Basic " & authInfo
Dim response As WebResponse = request.GetResponse()

运行后request.GetResponse()可以得到成功的结果。所以我认为 Pentaho 登录和身份验证成功

但是当我转到http://x.x.x.x:8080/pentaho/HomePentaho 时仍然提示登录页面...

你知道我的代码有什么问题吗?

提前致谢!!

【问题讨论】:

    标签: asp.net spring authentication pentaho


    【解决方案1】:

    不确定您要在这里做什么。你要去哪里 pentaho/Home。在你的代码中?

    如果您想在 Pentaho 中以编程方式调用某个 URL,将凭据附加到查询字符串可能更容易。

    【讨论】:

    • 感谢您的回复。可以看到代码Dim response As WebResponse = request.GetResponse()变量response可以成功得到pentaho的响应结果。所以我假设该代码通过了身份验证。但是当我进入pentaho的主页时,pentaho仍然提示登录页面...
    • 所以我想问一下如何在认证完成并成功后重定向到pentaho的主页?非常感谢!!!!!!
    【解决方案2】:

    您可以使用基本身份验证方法,我已经在下面的帖子中回答了这个问题。 enter link description here

    例如-

    WebClient webClient = new System.Net.WebClient();
    Uri uri = new Uri("http://serverDomain:8080/pentaho/Home");
    //Give user name and password here
    var plainTextBytes = System.Text.Encoding.UTF8.GetBytes("username:password");
    var encodedString = System.Convert.ToBase64String(plainTextBytes);
    webClient.Headers["Authorization"] = "Basic " + encodedString;
    webClient.Encoding = Encoding.UTF8;
    App.WindowManager.ConsoleWrite(uri.ToString());
    webClient.UploadStringAsync(uri, "POST", "");
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-26
      • 2017-02-12
      • 2017-08-19
      • 1970-01-01
      • 2017-01-01
      • 1970-01-01
      • 2013-12-31
      • 2016-07-25
      相关资源
      最近更新 更多