質問

ユーザーがファイルをクリックするたびにログインする必要がないように、ユーザートークンを取得してURLを構築しようとしています。以下は私のコードです。私の質問は、以下に示すトークン値全体を渡す必要があるか??私が得ているトークンの価値はです

symmetric:algorithm:QUVT:keyid:NTZkYTNkNmI=:data:7P9aJHzkfGTOlwtotuWGaMqfU9COECscA9yxMdK64ZLa298A3tsGlHKHDFp0cH+gn/SiMrwKfbWNZybPXaltgo5e4H4Ak8KUiCRKWfS68qhmjfw69qPv9ib96vL3TzNORYFpp/hrwvp8aX4CQIZlBA==

問題は、URLをコピーしてブラウザで過ぎた後、ログインページに移動することです。エラーはありませんが、ユーザーをImageViewerに直接連れて行く必要がありますが、ログインページにログインするには、ログインするとファイルを正しく開きます。

私は何が間違っているのですか?

string text = "";
            string userName = "userName";
            string pwd = "*****";
            fileNetID = "{5FCE7E04-3D74-4A93-AA53-26C12A2FD4FC}";
            Uri uri = null;
            string workplaceURL = "http://filenet:9081/WorkPlaceXT";
            uri = new Uri(workplaceURL + "/setCredentials?op=getUserToken&userId=" + this.encodeLabel(userName) + "&password=" + this.encodeLabel(pwd) + "&verify=true");
            System.Net.WebRequest webRequest = System.Net.WebRequest.Create(uri);
            System.Net.WebResponse webResponse = webRequest.GetResponse();
            StreamReader streamReader = new StreamReader(webResponse.GetResponseStream());
            String token = streamReader.ReadToEnd();
            string contentURL = string.Empty;
            contentURL = workplaceURL + "/getContent?objectType=document&impersonate=true&objectStoreName=OBJECTSTORE&id=" + HttpUtility.UrlEncode(fileNetID);
            contentURL += "&ut=" + HttpUtility.UrlEncode(encodeLabel(token));
            return contentURL;

正しい解決策はありません

他のヒント

私の機能は次のとおりです。最後にトークンを展開する方法を見ることができます。

public static string getCEUserToken(string baseURL, string uid, string pwd)
{
    string UserToken = "";
    System.Net.WebRequest request = System.Net.WebRequest.Create(baseURL +      "/setCredentials?op=getUserToken&userId=" + uid + "&password=" + pwd +
    "&verify=true");
    request.Method = "POST";
    System.Net.WebResponse response = request.GetResponse();
    Stream stream = response.GetResponseStream();
    byte[] token = new byte[response.ContentLength];
    stream.Read(token, 0, (int)response.ContentLength);
    response.Close();

    foreach (byte chr in token)
        UserToken += System.Convert.ToChar(chr);

    return System.Web.HttpUtility.UrlEncode(UserToken);
}
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top