var sidebar_align = 'right';
var content_container_margin = parseInt('350px');
var sidebar_width = parseInt('330px');
POST by code not Form (VB/ASP.NET)
Iv been looking troug google, and I found others asking for the same, but wit no answer.
I need to do a POST to a 3. party script who only accepts POST.
The problem is, I need to do something when the user clicks the button, So I cant remove the runat="server"part from the webform.
Is it posible to do a POST by code serverside?
If I could use GET I would just run the first part of the code, and then use redirect and a querystring afterwards.
I supose that if it is posible, I would need to use HttpRequest and RequestType or HttpMethod, but I cant figure out how... am I lost? or on the right track?
I'd use HttpWebRequest...
webRequest = (HttpWebRequest)HttpWebRequest.Create("http://www.urlYOUwantTOpostTO.com/page.aspx");
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.Method = "POST";
Byte chars = ASCIIEncoding.ASCII.GetBytes(username=" + username + "&password=" + password);
webRequest.ContentLength = chars.Length;
Stream request = webRequest.GetRequestStream();
request.Write(chars, 0, chars.Length);
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
srResponse = new StreamReader(response.GetResponseStream());
strResponse = srResponse.ReadToEnd();
Zend also has a solution to this in php.
not sure if that's what you're looking for though.