无法将文本保存到数据库 [英] Cant save text to database

查看:91
本文介绍了无法将文本保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将视频的嵌入代码保存在数据库中.我的布局如下:

I am trying to save the embed code for a video in the database. The layout I have is as follows:

<asp:TextBox ID="txtVideoThumbnailURL" placeholder="Video Thumbnail URL" runat="server" /><br />
                <asp:TextBox ID="txtVideoURL" placeholder="Video Url" runat="server" />
                <asp:Button ID="bntAddVideo" runat="server" Text="Add Video" OnClick="btnAddVideo_Click" />



如果我在视频URL"框中添加随机文本,则效果很好,但是,一旦我尝试保存嵌入代码,则不会发生事件返回服务器.以下是嵌入代码的示例:

< object style ="height:390px; width:640px">< embed src ="http://www.youtube.com/v/1sujhF102Uw?version=3&feature=player_detailpage" type ="application/x -shockwave-flash"allowfullscreen =" true"allowScriptAccess =" always"width =" 640"height =" 360></object>

有任何建议吗?



If I add random text into the Video URL box it works fine, but as soon as I try save the embed code it doesnt event go back to the server. Here is an example of embed code:

<object style="height: 390px; width: 640px"><embed src="http://www.youtube.com/v/1sujhF102Uw?version=3&feature=player_detailpage" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="640" height="360"></object>

Any advice?

推荐答案

如果您需要在表单上接受原始HTML,则必须将page指令的ValidateRequest属性设置为false.请注意,尽管这样做将允许所有HTML,包括任何人都想到的讨厌的东西,都可以从该页面上载.您应谨慎使用
If you need to accept raw HTML on your form you must set the ValidateRequest property of the page directive to false. Be warned though this will allow all HTML, including anything nasty anyone can think of, to be uploaded from that page. You should use it with caution


这篇关于无法将文本保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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