on 07-07-2004 3:03 AM
Hi,
My company is using sap R/3 4.6c and VS.Net 2003. I am trying out the example as provided in the SAP .Net Connector document to connect from .Net web application to SAP. I have followed the steps in the example to create sap proxy, SAPLogin1.aspx and drag in the Connect code from the SAP proxy toolbox. I get the error Invalid Connection String at the coding "SAP.Connector.SAPLoginProvider.GetSAPConnection(this);" when I clicked the button. Based on the document, I am supposed to be redirected to SAPLogin1.aspx. Appreciate any help and advise.
Regards
Sometimes you don't get redirected to logon. In those cases you need to modify the <authorization> section in Web.config. It should contain <deny users="?" /> - so uncomment it. It shouldn't contain anything else.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't understand the question, but here's what SAPLoginProvider does:
OpenSAPConnection opens a connection on the given connection string and stores it (the Connection) into Session state. Also it will tell Microsoft's Form Authentication Provider, that the user is authenticated. As a result it will store a cookie on the client machine.
GetSAPConnection will try to get the connection from Session state. If it fails, it will try to create a new connection based on the data in the cookie. If this also fails, it will inform the Microsoft Forms Login Provider that the user is not logged in anymore. This will usually cause a new Redirect to the login page.
CloseSAPConnection will close the connection is session state and tell Microsoft' Forms Authentication provider that the user is logged out.
I haven't understood well which is the best place to put the call to CloseSAPConnection() in an Asp.Net (perhaps) basic scenario, where a single connection is used for the whole user session activity;
I thougt about the Session_End event: if it's the case, what should I pass to the CloseSAPConnection() method?
thank you.
This is an excellent question.
In the original design, we assumed that everything should work automatically: At session end the SessionModule would automatically Dispose all objects in the session state - which would close the connection.
In fact I have heard of cases where this doesn't work as expected.
A possible workarround would a code snipped like the following:
protected void Session_End(Object sender, EventArgs e)
{
SAPConnection conn = this.Session[SAPLoginProvider.SAP_CONNECTION] as SAPConnection;
if (conn != null)
{
conn.Close();
this.Session.Remove(SAPLoginProvider.SAP_CONNECTION]);
}
}
Calling CloseSAPConnection would have a similar effect, but you could not call it here as it needs a page as parameter. And it would also try to sign out the user from the MS FormsAuthenticationProvider (which doesn't make a lot of sense at session end.
Anyway, Microsoft doesn't guarantee Session_End to be called at all. Therefore we have changed the design of SAPLoginProvider in NCo 2.0: Here we don't store the Connection in session state, but only the connection string / Destination. The connection itself would be stored in Connection Pool. The Pool has a timeout behavior that we consider being more reliable than the Session_End timeout.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.