Hello all,
This is my first post so please bear with me if I do anything wrong or post in the wrong place.
I have been sent the following code behind from my domain registration company which is in c#. The problem is I code in VB. I have been onto my domain company to send me a VB version but they aren't very helpful.
I would appreciate it if someone could give me the VB version of the code below.
Thanks in advance.
Code:
using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Net;
using System.IO;
public partial class _HttpApi : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void emulate_call_Click(object sender, EventArgs e)
{
WebRequest request = WebRequest.Create("http://test.httpapi.com/api/domains/available.xml?auth-userid=(myid)&auth-password=(mypass)&domain-name="+url.Text+"&tlds="+ddl1.SelectedValue);
try
{
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream());
Response_Body_Div.InnerHtml = reader.ReadToEnd();
Response_Header_Div.InnerHtml = getResponseHeaders(response);
Response_Status_Div.InnerHtml = ((int)response.StatusCode).ToString();
}
catch (WebException wx)
{
Response_Status_Div.InnerHtml = (((int)((HttpWebResponse)wx.Response).StatusCode)).ToString();
Response_Header_Div.InnerHtml=getResponseHeaders((HttpWebResponse)wx.Response);
Response_Body_Div.InnerHtml =(new StreamReader(wx.Response.GetResponseStream()).ReadToEnd());
}
}
private static string getResponseHeaders(HttpWebResponse response)
{
string responseHeader = "";
foreach (String headerKey in response.Headers.AllKeys)
{
responseHeader += headerKey + ":" + response.Headers[headerKey].ToString() + "<br/>";
}
return responseHeader;
}
}
The example of the page in action if it helps is
My Test Page