Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post Coding Translation If Possible Please

    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

  • #2
    New Coder
    Join Date
    Aug 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No one knows C# and VB ??

  • #3
    New Coder
    Join Date
    Aug 2011
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Managed it.

    Disappointed with the lack of response though.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •