Skip to Content
0
Former Member
Oct 28, 2005 at 09:18 PM

Set Cookie in ASP & Read in WebDynpro

36 Views

Hi All,

I have button "Signature" in Webdynpro screen, when click that button i am calling URL iview (..\Simple.aspx ) & it opens and show in new window. Now i wanted to set cookie in ASPx file and read the same in Webdynpro screen. In the Webdynpro I am not able to read the cookie which was set in aspx file. In the aspx file I am able to see 4 portal cookies when call alert(document.cookie );. I am able to read 4 portal cookies even in the webdynpros but not my custom cookies ( by aspx file )

Here is my Code:

Java script code in ASPX file:

function setCookie()

{ window.document.cookie= "SIGN2=RAMANA";

alert(document.cookie);

}

<input type=button value="Set Cookie" onClick="setCookie()">

Code in WebDynpro:

//HttpServletRequest req =((com.sap.tc.webdynpro.services.sal.adapter.core.IWebContextAdapter) WDWebContextAdapter.getWebContextAdapter()).getHttpServletRequest();

Cookie[] cookies = TaskBinder.getCurrentTask().getWebContextAdapter().getHttpServletRequest().getCookies();

IWDMessageManager msgmgr = wdComponentAPI.getMessageManager();

int len = cookies.length;

for ( int j =0 ; j<len; j++)

msgmgr.reportSuccess(cookies[j].getName() + ":" +cookies[j].getValue());

I appreciate your help.

Thanks,

Ramana.