cancel
Showing results for 
Search instead for 
Did you mean: 

Use SAPLogonTicket for Authentication in .Net web Application

Former Member
0 Kudos

I created a iView Url to call a .net web application from SAP Portal. I would like to authenticate the users in my .net web application by using the SAPLogonTicket/MYSAPSSO2. I hope to be able to read the SAP Portal credentials (userid, etc..) in my .net page.

1) Can someone please tell me if this is the right approach to persisting sap portal authentication to .net web applications?

2) Do I really need the PDK to do this?

3) Sample code in C# or vb.net.

Any help will be greatly appreciated.

Thank you,

James

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Thanks you for your help.

-james

Former Member
0 Kudos

UPDATE:

Is there a non-NWDS way to add the MYSAPSSO2 cookie to the response object? Maybe by using ABAP Webdynpro, some other type of iView (url or transaction).

This article I found essentially takes the approach of creating a NWDS portal application to add the MYSAPSSO2 cookie to the response object to then redirect the portal user to the 3rd party (.net web application). The cookie should be made available to the .net web application after the redirect. [How to Enable Single Sign-on with Non-SAP Web |http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/d0c78148-12de-2a10-27bf-960acc753aab] This is not an option I can implement at this time.

Thanks,

James

Daniel_KASIMIR
Participant
0 Kudos

Hi James,

I had no problems using the SapLogonTicket from within my asp.net application to authenticate the sap.net connector 3.0.

You have to notice that both systems are in the same domain to be able to read the cookie.

http://sapportal.mydomain.com --> http://aspserver.mydomain.com

If Not IsNothing(My.Request.Cookies("MYSAPSSO2")) Then

            _ecc = RfcDestinationManager.GetDestination(WebConfigurationManager.AppSettings("SAP_Destination")).CreateCustomDestination
            _ecc.SAPSSO2Ticket = My.Request.Cookies("MYSAPSSO2").Value
            Try
                _ecc.Ping()
                Debug.Print("SAP SSO-Ticket found:" & _ecc.AliasUser)
            Catch ex As RfcLogonException
                Debug.Print("User has no access rights!")
            End Try

        Else
            Debug.Print("SAP SSO-Ticket NOT found. Please log in to SAP-Portal: " & My.User.Name)
End If

Regards

Daniel K.

Edited by: Daniel Kasimirowicz on Jun 30, 2011 11:43 AM

I'm using SAP .net Connector 3.0

Former Member
0 Kudos

The domain was key to me seeing the Cookie in the .net application. As soon as I deployed the web application to a location with the same domain name the cookie was visible. Do you have example code of how to extract username from the cookie on the .net side?

Thank you for your help,

James

Daniel_KASIMIR
Participant
0 Kudos

No, I'm sorry.

I don't do anything with the cookie but use it for authentication against the .net connector.

Regards

Daniel