Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# 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 April 22nd, 2008, 09:51 AM
Authorized User
 
Join Date: Apr 2008
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default HTML tag problem

Hi,

I'm new to C#. I have some basics. I have a problem. In one login form, if i put in username text box one html tag ('< br >') it show me one error : Sys.Webforms. PageRequestManag erServerErrorExc eption: An uknown error occurred while processing the request on the server. The status code returned from the server was: 500


You have any suggestion how to fix this?

Thank you
__________________
Thank you
 
Old April 22nd, 2008, 09:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

HTTP Status 500 is an Internal Server Error, which normally denotes some problem with the application running on it in my (limited) experience.

The <br> tag is a HTML tag for a Line Break? Where are you using this tag in your login form? Can you paste the sample of that part of the code (not all of it please)..

Rob
http://robzyc.spaces.live.com
 
Old April 22nd, 2008, 10:23 AM
Authorized User
 
Join Date: Apr 2008
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I don't need the html tag. The problem is that my application will crash if someone will put that tag into my username text box. I want to prevent that from happening. So, I need someway to test or remove the html tags from my text boxes. I heard something about Regular expressions .

I can paste here some code , but I don't know if will help you.




Thank you
 
Old April 22nd, 2008, 10:28 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 432
Thanks: 0
Thanked 1 Time in 1 Post
Default

Ah OK, now I am with you.

I am unsure as to why that would make a difference, since the login should just be treated as a string, completly ignoring any HTML in there regardless.

There are a number of ways you can do this, removing characters, RegEx would prob be the best option, but sadly my RegEx knowledge is limited, maybe someone else here will be able to help more :)

Rob
http://robzyc.spaces.live.com
 
Old April 22nd, 2008, 10:36 AM
Authorized User
 
Join Date: Apr 2008
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

I hope I'll solve this problem. I'll try to do something with regular expressions, after I find something to read about that.

Anyway , thank you very much for your time

Thank you
 
Old April 22nd, 2008, 10:40 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

I think you are running into a validation mechanism from ASP.NET, helping you to prevent cross-side script and other injection attacks.

The technique is called Request Validation and can be turned off. However, you are advised to do this only if you take other preventive actions. For more info see: http://www.asp.net/learn/whitepapers...st-validation/

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.
 
Old April 22nd, 2008, 11:00 AM
Authorized User
 
Join Date: Apr 2008
Posts: 16
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Yes, it's working.

Thank you Imar, it was a great help

Thank you
 
Old April 22nd, 2008, 11:04 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Make sure you don't just disable this feature; make sure your system can also deal with invalid input and is not open to SQL Injection by checking / sanitizing the data.....


Imar


---------------------------------------
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to pull data between two different HTML tag boniggy Visual Basic 2005 Basics 0 February 6th, 2008 02:36 AM
HTML tag from C# or ASP.NET tag from javascript angshujit ASP.NET 2.0 Basics 3 February 16th, 2007 10:07 AM
TEXTAREA tag in html sapphire87 PHP How-To 0 July 26th, 2006 02:25 PM
HTML tag vs Body Tag CFGerry BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 October 7th, 2005 07:13 AM
Using HTML Tag on Netscape Composer futurika HTML Code Clinic 1 October 24th, 2003 11:45 PM





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