English 中文(简体)
如何从c#中获取原始页面来源(不是来源)
原标题:How to get raw page source (not generated source) from c#
  • 时间:2011-09-23 09:00:06
  •  标签:
  • c#
  • html

目的是获取网页的原始来源,我指的是不会操作文字,或者让浏览器完全使用页。 例如:在回复之后,应用源为:<代码><table><tr>/table>;在回复之后,我不希望通过密码获得<代码><table><tr></tr></tone></table>,如何通过密码做到这一点?

更多信息:例如,浏览器地址酒吧中的“view-source:http://feeds.gawker.com/kotaku/full”类型将提供u xml文档,但如果你只是“http://feeds.gawker.com/kotaku/full” 它将放下一个html页,我想的是Xml文档。 希望是明确的。

最佳回答

Here s one way, but it s not really clear what you actually want.

using(var wc = new WebClient())
{
    var source = wc.DownloadString("http://google.com");
}
问题回答

If you mean when rendering your own page. You can get access the the raw page content using a ResponseFilter, or by overriding page render. I would question your motives for doing this though.

文本由客户管理,因此对任何文本没有影响。

You can use a tool such as Fiddler to see what is actually being sent over the wire.

disclaimer: I think Fiddler is amazing





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签