Cannot retrieve Context.Items posted to a web page.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • SPanicker
    New Member
    • Dec 2008
    • 16

    Cannot retrieve Context.Items posted to a web page.

    Hi,

    I am trying to post some information as context item to another web page but not able to retrieve the value of context items on the page load of the page receiving the request. Both the websites are in different domains.

    Can someone tell me how can i achieve this?

    I have the HTTPWebRequest created as below:
    Code:
    	    WebRequest postDataWebRequest = WebRequest.Create(searchUrl);
                HttpWebRequest postDataHttpRequest = (HttpWebRequest)postDataWebRequest;
                postDataHttpRequest.ContentType = "text/plain";
                postDataHttpRequest.KeepAlive = true;
                postDataHttpRequest.Method = "POST";
    
                this.Context.Items.Add("testkey", txtUsrName.Text);
    
                HttpWebResponse searchResultResponse = (HttpWebResponse)postDataHttpRequest.GetResponse();
    Below is code snippet on the page to read back the context item.
    Code:
     protected void Page_Load(object sender, EventArgs e)        
    {
                   string test;
                   test = this.Context.Items["testkey"].ToString(); // ---> exception thrown here.
                        Response.Write(test);
    }
Working...