Link to home
Start Free TrialLog in
Avatar of Dinesh Bali
Dinesh Bali

asked on

Session Value gets null once we get response from external URL

Hi,

I am working on C# MVC application.

I have payment integrated in my website. For payments, we call payment url which is loaded in iFrame.
We have no control on the form which opens in iFrame, as it captures credit card details.

Now, once user does the payment by clicking submit button in payment form, which (submit form) is in iFrame.

After successful/unsuccessful transaction we are receiving response in handler page.

After getting response in handler page we are losing session of our web application.

It works well in chrome but does not work in IE, Firefox.

What we should do so that we should not loose our session once the redirect happen.

Also, we see Chrome has same id before and after confirmation done.

But other browser gives us different session id's when returns from payment page.

Please advise the solution.

I have below configuration in my web.config already.
<httpCookies httpOnlyCookies="true" requireSSL="false" />
ASKER CERTIFIED SOLUTION
Avatar of Zvonko
Zvonko
Flag of North Macedonia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Here for documentation the Solution from above second link:


I did it!
had to change some stuff to the code u posted though.

    void Application_EndRequest(Object sender, EventArgs e)
    {
        if (Response.Cookies.Count > 0)
        {
            foreach (string s in Response.Cookies.AllKeys)
            {
                if (s == "ASP.NET_SessionId")
                {
                    Response.Cookies["ASP.NET_SessionId"].HttpOnly = false;
                }
            }
        }
    }