Go Back   CodingForums.com > :: Server side development > ASP.NET

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-11-2011, 08:44 AM   PM User | #1
MISCHU
New Coder

 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
MISCHU is an unknown quantity at this point
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
MISCHU is offline   Reply With Quote
Old 08-12-2011, 09:54 AM   PM User | #2
MISCHU
New Coder

 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
MISCHU is an unknown quantity at this point
No one knows C# and VB ??
MISCHU is offline   Reply With Quote
Old 08-17-2011, 10:28 PM   PM User | #3
MISCHU
New Coder

 
Join Date: Aug 2011
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
MISCHU is an unknown quantity at this point
Managed it.

Disappointed with the lack of response though.
MISCHU is offline   Reply With Quote
Reply

Bookmarks

Tags
asp, asp.net, aspvb, vb.net

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:33 AM.


Advertisement
Log in to turn off these ads.