如何在asp.net页面中单独显示一段html代码 [英] How to show piece of html code seperately in asp.net page

查看:114
本文介绍了如何在asp.net页面中单独显示一段html代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我想知道,如果我通过asp.net网页向某个abc服务器发送http请求并将其发送到http服务器,并且作为响应,该服务器向我返回了一些html代码,那么我如何在asp.net页面上查看该html响应的设计.
目前,我的门户网站上的响应显示在文本框中的modalpopup控件中.
请告诉我在我的门户上需要进行哪些更改才能查看该html代码的设计.

在asp.net中是否有任何控件可以做到这一点??????

谢谢

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

推荐答案

你好,

希望Iframe可以解决问题

< iframe src =链接到页面"></iframe>

谢谢!!!
Hello,

Hope Iframe can do the trick

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

Thanks!!!


使用编码的HTML怎么办?

您可以在此处查看实时示例: http://opinionatedgeek.com/DotNet/Tools/HTMLEncode/Encode.aspx [^ ]

希望对您有所帮助.
What about using encoded HTML?

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

Hope it helps.


下面是代码,它将指导您从url post中获取响应

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


这篇关于如何在asp.net页面中单独显示一段html代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆