Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 22nd, 2008, 09:51 AM
Authorized User
 
Join Date: Apr 2008
Location: Brasov, Romania, Romania.
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
Reply With Quote
  #2 (permalink)  
Old April 22nd, 2008, 09:58 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old April 22nd, 2008, 10:23 AM
Authorized User
 
Join Date: Apr 2008
Location: Brasov, Romania, Romania.
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
Reply With Quote
  #4 (permalink)  
Old April 22nd, 2008, 10:28 AM
Friend of Wrox
 
Join Date: Mar 2007
Location: Hampshire, United Kingdom.
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
Reply With Quote
  #5 (permalink)  
Old April 22nd, 2008, 10:36 AM
Authorized User
 
Join Date: Apr 2008
Location: Brasov, Romania, Romania.
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
Reply With Quote
  #6 (permalink)  
Old April 22nd, 2008, 10:40 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
  #7 (permalink)  
Old April 22nd, 2008, 11:00 AM
Authorized User
 
Join Date: Apr 2008
Location: Brasov, Romania, Romania.
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
Reply With Quote
  #8 (permalink)  
Old April 22nd, 2008, 11:04 AM
Imar's Avatar
Wrox Author
Points: 72,038, Level: 100
Points: 72,038, Level: 100 Points: 72,038, Level: 100 Points: 72,038, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,080
Thanks: 80
Thanked 1,587 Times in 1,563 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.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 09:07 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.