문제

I'm trying to do a little "performance Test" for SAP WebUI. Therefore I have to sign in several times with different users from a C# programm. The HTTP-traffic will be tracked by fidllercore.dll.

Now, my problem is even after two days of research I am not able to automatically sign in to the SAP WebUI. If I open a link via HttpWebRequest and submit my username and password, the response stream contains only the LogOn-Html.

I remember there should be way to sign in via SSO2-Cookies, but I couldn't find nothing in particular about this. That's pretty close to what i've done yet: Login to website, via C#

Request.BeginGetRequestStream(new AsyncCallback(GetRequestStreamCallback), Request);

private static void GetRequestStreamCallback(IAsyncResult result)
{
    if (result != null)
    {
        //Removed password from code!
        String data = "&sap-user=******&sap-password=**********";
        HttpWebRequest request = (HttpWebRequest)result.AsyncState;

        // End the operation
        System.IO.Stream newStream = request.EndGetRequestStream(result);

        // Convert the string into a byte array.
        byte[] dataStream = Encoding.UTF8.GetBytes(data);

        // Write to the request stream.
        newStream.Write(dataStream, 0, dataStream.Length);
        newStream.Close();

        //Thread.Sleep(5000);
        request.BeginGetResponse(new AsyncCallback(FinishWebRequest), request);
    }
}
도움이 되었습니까?

해결책

Finally fount this.

I had to perform an GET-Request with the parameters &sap-user=****&sap-password=***. It is important to set them in the right order, as you can see following the link above.

Thanks!

Edit: Due to SAP-CRM-WEB-UI sends redirect and Cookies all in same request and HttpWebRequest ignores these Cookies for redirect, you have to handle this nanually (like explained here).

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top