English 中文(简体)
允许和允许某些超文本性质
原标题:Allow and Limit some HTML characters

我已经建立了一种信息发布系统,用户可以相互传递信息,也可以将文件作为电文(如简单的电子邮件系统)的随附发送。 允许用户发送超文本,如果用户进入,则由浏览器投送。

<b>Hello</b>

it ll rendered as Hello

如果用户进入,其工作罚款就是一个问题。

<iframe src="anywebsite"><iframe>

browser还给它带来的痛苦。

How can i allow only some particular characters to be rendered by browser rest will display as normal text I am using Asp.net MVC3

In my model class i ve add
[AllowHtml] attribute to allow HTML characters

问题回答

http://wpl.codeplex.com/“rel=“nofollow” AntiXs Library:

例如:

@Html.Raw(Sanitizer.GetSafeHtmlFragment("<b>Hello</b>"))
@Html.Raw(Sanitizer.GetSafeHtmlFragment("<iframe src="anywebsite"><iframe>"))

第一种做法是将Hello文本变成黑体字,而第一种胜诉则使案文变得毫无安全。

也可检查





相关问题
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. ...

热门标签