المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : help needed for httpwebreqest and postback



C# Programming
06-30-2009, 12:01 PM
i have a problem when i use the httpwebrequest for a page the page is displayed correctly and when but ispostback is always false.
i m sending the viewstate data too but it is still false
how can i make it to true so that i can access the full data.
the code is as follow



static ******Container ******Jar = new ******Container();

public string PostContenct(string dataPost, string srcuri)
{
Uri uri = new Uri(srcuri);
string data = dataPost;
//if (uri.Scheme == Uri.UriSchemeHttp)
//{


HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(uri);
request.******Container = ******Jar;
request.AllowAutoRedirect = true;
request.Method = WebRequestMethods.Http.Post;
request.ContentLength = data.Length;
//request.AllowAutoRedirect = true;
request.ContentType = "application/x-www-form-urlencoded";

StreamWriter writer = new StreamWriter(request.GetRequestStream());
writer.Write(data);
writer.Close();

HttpWebResponse response = (HttpWebResponse)request.GetResponse();
int ******count = ******Jar.Count;
StreamReader reader = new StreamReader(response.GetResponseStream());
string str = response.StatusDescription;
string tmp = reader.ReadToEnd();
response.Close();
return tmp;
//}
//else
//{
// return "";
//}

}



thanks

amirzada