Click here to Skip to main content
15,904,024 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I want to know that if i send and http post request to some abc server through asp.net web page and in response that server returns me some html code, how can i view the design of that html response on my asp.net page.
Currently, the response on my portal is show in modalpopup control in the text box.
Plz tell me what changes are required on my portal to view the design of that html code.

Is there any control available in asp.net to do that????????

Thanks
Posted
Updated 28-Aug-12 8:57am
v2
Comments
[no name] 28-Aug-12 15:01pm    
What do you mean "view the design of that HTML"?
junaidcodeproject 28-Aug-12 15:07pm    
I mean if <html><head></head><body>hello</body></html> is sent to me
then i should view only "hello".
jkirkerx 28-Aug-12 17:52pm    
Well you have to get the innerHTML by parsing the body tag, which means writing lots of code.

try searching this keyword
asp.net, parse html elements

[edit]

You didn't specify how you want to display or show the results, in a textarea that is scrollable, or in a div tag?

Hello,

Hope Iframe can do the trick

<iframe src="link to page"></iframe>

Thanks!!!
 
Share this answer
 
What about using encoded HTML?

You can view a live example here: http://opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx[^]

Hope it helps.
 
Share this answer
 
Here is the code, which will guide you to get the response back from url post

            //uri is the url where you want to do HTTP Post
            HttpWebRequest myHttpWebRequest = null;
            HttpWebResponse myHttpWebResponse = null;
            try
            {
                myHttpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
                myHttpWebRequest.MaximumAutomaticRedirections = 1;
                myHttpWebRequest.AllowAutoRedirect = true;
                myHttpWebResponse = (HttpWebResponse)myHttpWebRequest.GetResponse();

                var reqStream = myHttpWebResponse.GetResponseStream();
                StreamReader reader = new StreamReader(reqStream);
                string responseFromServer = reader.ReadToEnd();
             }
             catch(Exception ex){
                //do you exception stuff
             } 

Hope this help.
cheers
 
Share this answer
 
Hi,

[Edit]
If you go to the Create New Article in CodeProject there is one control that can be used to display html design/Code. ASP.Net don't have such control. Either you need to create your own control or you need to search for such control.

Something like this[^] Although this is very complex one but you can create simple as per your need.

[/Edit]

[Removed Info="This can be used only if OP want to monitor request/response"]
If you do not want to get that Response in code behind and if you want to view that response only for your knowledge and view purpose then you can use Firefox Addins FireBug.

FireBug is very powerful tool to view each request and responses. you can even view list of javascript/css/images/html responded from the server.

You can find FireBug from Here[^]
[/Removed]

Best luck
Thanks
-Amit Gajjar
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900