Wrox Programmer Forums
|
BOOK: ASP.NET Website Programming Problem-Design-Solution
This is the forum to discuss the Wrox book ASP.NET Website Programming: Problem - Design - Solution, Visual Basic .NET Edition by Marco Bellinaso, Kevin Hoffman; ISBN: 9780764543869
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET Website Programming Problem-Design-Solution section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 14th, 2004, 12:39 PM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default News Module/storing html in databases

Hello,

I was Wondering if the text data-type in SQL Server 2000 can store HTML or not? I mean can I store html in sql server?

 when I tried that in the admin pages of the news module I got the following exception.
---------------
An unexpected error has occurred in this Application. The system administrators have been notified. Please feel free to contact us with the information surrounding this error.
The error occurred in: http://localhost/ThePhile/Modules/Ne...x?CategoryID=2
Error Message: A potentially dangerous Request.Form value was detected from the client (NewsGrid:_ctl3:EditBody="...s
----------------
so what's the story of this excpetion???
Thanks
Marenela

 
Old September 14th, 2004, 05:00 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Of course you can store HTML in SQL Server. But you can't send submit some dangerous HTML tags to a web page.

This is done to prevent Cross-Site Scripting (XSS) attacks against web sites.

You can disable this with ValidateRequest="false" in the Page directive, but you must never do this on a production system! This could allow a hacker to steal a security cookie by inserting a JavaScript routine into your web page.

Eric
 
Old September 15th, 2004, 03:13 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok. I need to disable it only in the administration page of the news module and no one (except administrators) will log into this pages. what do you think?
Thanks
Marenela

 
Old September 15th, 2004, 09:43 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

That sounds like a pretty good idea. It's safe if it's only for pages that require admin priviledges.

Eric
 
Old September 17th, 2004, 02:59 PM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Eric,

 I put ValidateRequest="false" is the page directive of the shownews.aspx in the news module and I still get the same exception. so why?
Thanks
Marenela

 
Old September 20th, 2004, 09:04 PM
Registered User
 
Join Date: Sep 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm new to ASP.NET and am having a similar problem. However, what is the "Page directive" and/or what is the proper syntax of entering it? When I enter it in my code, I get the following error: BC30451: Name 'validateRequest' is not declared.


Shea Ellison
Strategic Internet Consulting
Creating Measurable Value Through Your Internet Presence
Office Direct Line: 770-454-1190
Voicemail/Fax: 888-227-4979
www.strategic-internet.com
 
Old September 20th, 2004, 10:13 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Shea - This should only be used in special cases. You should NOT do this unless you have a functional requirement to post HTML tags to an .aspx page. This web site works fine without this setting. I don't have this setting on any of my pages.

Marenela - I think you put it on the wrong page. Which page are you trying to post back to? Shownews.aspx is not used to receive inputs from the user. I think you want to try it on SubmitNews.aspx.

This ValidateRequest feature is only used to prevent users from submitting HTML tags as text input in a page. Pages that don't accept text input won't be affected by this setting.

If anyone doesn't understand the security ramifications of doing this, then please do NOT do this. This is very dangerous. Marenela only wants to do this on restricted pages, so I relunctantly went along with this.

I think there are better ways of sending HTML keys to a database. Why not use a Windows Forms application to update your SQL Server database if you want HTML to be entered by administrators? You can make a much nicer application using Windows Forms - the only downside is that it doesn't work in a web browser. But it DOES work remotely, and you should be able to connect to a remote SQL Server database this way. You could get creative and make this into a SmartClient application that DOES get launched from a Web Browser accross the Internet. The only downside of a SmartClient app is that users need the .NET Framework on their computer. This is easy to enforce for administrators.

Eric
 
Old September 21st, 2004, 03:06 AM
Authorized User
 
Join Date: Aug 2004
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello Eric,

 So I can log remotely to SQL Server 2000? Great but tell me. Do I know knowledge of remoting? or just work as local and put the server name and address in the connection string?
Thanks,
Marenela

 
Old September 21st, 2004, 06:54 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 917
Thanks: 0
Thanked 0 Times in 0 Posts
Default

You have to configure the SQL 2000 Client Network Utility, and then modify your connection string. This is not the same thing as .NET remoting.

Eric





Similar Threads
Thread Thread Starter Forum Replies Last Post
Storing HTML in a Variable Stevenm122084 XSLT 1 February 22nd, 2008 03:51 PM
Separating news from the articles and add news pic Isaak BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:25 AM
news module - adding new categories andieje BOOK: ASP.NET Website Programming Problem-Design-Solution 3 June 30th, 2006 07:55 PM
Module News Problem thanhh83 BOOK: ASP.NET Website Programming Problem-Design-Solution 9 May 16th, 2006 09:41 PM
news database gtmm9 Classic ASP Databases 6 October 17th, 2003 01:34 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.