Skip to Content
0

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

Feb 01, 2017 at 10:05 PM

163

avatar image

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!

10 |10000 characters needed characters left 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

0
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Melanie Harris Feb 06, 2017 at 02:32 PM
0

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?

Share
10 |10000 characters needed characters left characters exceeded
Melanie Harris Feb 06, 2017 at 06:41 PM
0

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;

}

}

Share
10 |10000 characters needed characters left characters exceeded