Home > Mobile >  C# Application, Cookies not set when we open application through iFrame tag
C# Application, Cookies not set when we open application through iFrame tag

Time:08-20

I have created one web application and when i run application in normal browser windows it works perfectly. But when i open same application in iFrame tag my cookies get vanished automatically.

When I Inspect browser window i can see the cookies and session but it won't work. enter image description here

CodePudding user response:

This is probably because you have not set the domain on the web.config

Some times you call the iframe with out the www. on your domain, and this is set a different cookie than when you have the www.

so on web.config set the domain where its needed, eg:

<authentication mode="Forms">
  <forms domain="local.com" />
</authentication>

<httpCookies domain="local.com" />

CodePudding user response:

I have added below config in web.config file 

 <sessionState mode="InProc" timeout="500" cookieSameSite="None"/> 
        <httpCookies httpOnlyCookies="true" requireSSL="true" domain="local.com"/>
        <authentication mode="Forms">
            <forms loginUrl="~/Auth" timeout="500" slidingExpiration="true" domain="local.com"/> 
        </authentication>

But still cookies not set. Could you please assist?
  • Related