Skip to Content
avatar image
Former Member

Get SAP Logon Ticket in C# from web application on IIS running on different server than NetWeaver

Our company uses SSO to netweaver. I have a .net c# web application that is running on a different IIS server than netweaver that has to somehow programmatically get a SAP Logon Ticket string. I've downloaded the SAP .NET Conector 3.0 (2 DLLs) off of github, but don't see any methods to get a Logon Ticket.

Please let me know how I can accomplish this. Thanks!

Add comment
10|10000 characters needed characters exceeded

  • Hi Melanie,

    I have adjusted the tags on this question to better reflect the topic, and hopefully draw in more relevant responses. Specifically, I moved it from "SAP NetWeaver" to "SAP Single Sign-On," and added "portal development kit for Microsoft .NET."

    Cheers,
    Matt

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Feb 06, 2017 at 02:32 PM

    Thanks Matt! I've gotten the login ticket from the browser cookie using C# and a HttpRedirect, but had to hard code user id and password. I need to be able to do this without providing a user id and password. Can anyone show me some code on how to accomplish this?

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Feb 06, 2017 at 06:41 PM

    Got it!

    var request = (HttpWebRequest)WebRequest.Create(urlToPortal);

    request.CookieContainer = newCookieContainer();

    request.MaximumAutomaticRedirections = 4;

    request.MaximumResponseHeadersLength = 4;

    request.Credentials = CredentialCache.DefaultCredentials;

    HttpWebResponse response = (HttpWebResponse) request.GetResponse();

    model.RequestedEvent = response.StatusCode.ToString();

    foreach (Cookie cook in response.Cookies)

    {

    if (cook.Name == "MYSAPSSO2")

    {

    model.SAPLoginTicket = cook.Value;

    }

    }

    Add comment
    10|10000 characters needed characters exceeded