I want to validate the entry allowing only CSS code ... if javascript, iframe and other intances of such are found it should throw an exception.
Meaning they should be able to enter only .Func{param: blah;} and comments /*comment*/
Thank you so much
I want to validate the entry allowing only CSS code ... if javascript, iframe and other intances of such are found it should throw an exception.
Meaning they should be able to enter only .Func{param: blah;} and comments /*comment*/
Thank you so much
You want to validate using only CCS(that i actually have no idea what you are asking anyhow) but yet again you want to use .Func{param: blah;} that is javascript.Can you explain exactly what do you want because your question does not make sense.Thanks.
Slow as hell.
I have a TextBox control where people type stuff. They type everything including javascript code, html code, css code etc. etc. then everything is saved into database.
What i want is that i validate what they typed there (on the server or client side) and warn them if they have typed anything but CSS.
For instance
VB.NET Code:
If TextBox1.Text.Contains("<script") Then Alert('Your should use this field for css only') Else SaveIntoDatabase(TextBox1.Text)
But, do you know any easy way instead checking all those non-css stuff?
Thank you
P.S. consider it to be css editor but nothing fancy.
Last edited by selanec; Jul 21st, 2012 at 12:55 PM.
Sorry i don't know of a simple way.You either need to use a regex(if exists) with RegularExpressionValidator, or you will have to find a CSS parser to use or you will have to do it in code as you stated.If your goal is to use the CSS that is written then i would suggest to find a CSS parser-validator to see if CSS checks alright and save it to database.
Do some googling.
Slow as hell.
The best approach is to use regex and validate for allowed chars. So word and ccs chars are allowed anything that is not fails validation. This is easier than trying to find all possible chars that you don't allow.
Do you know regular expressions? The same expression will work both client and server side.
lastly you can htmlEncode the input and htmlDecode only allowed chars so if anything slipped through validation it will be encoded and be treated as text in the browser.
I don't know anything out of the box that does all this so if you need a hand let us know.
The problem with computers is their nature is pure logic. Just once I'd like my computer to do something deluded.
Hello,
Knowing the syntax of a language means that you can apply a lexer and parser to a code snippet to identify a language, in your case CSS.
I have never played with it, but a quick google turned up this:
http://www.antlr.org/
Which you seem to be able to configure to identify the language of your choice.
Might be worth taking a look.
I also turned up this:
http://www.phpied.com/css-lexer/
Hope that helps!
Gary
Remember to mark your thread as resolved. Remember to rate posts that help. Hitchhiker's Guide to Getting Help at VB Forums.
ASP.NET Tutorials (updated Feb 1st 2009) ASP.NET FAQs (updated July 17th 2011)
Free Stuff: WebsiteSpark|DreamSpark|BizSpark|eBooks
Learning Resources: MSDN|LearnVisualStudio|TrainingSpot|ScottGu's Blog|ASP.Net Starter Kits|Regex|RegExLib
Useful Tools: XPath Builder|UltraMon|RegExBuddy|CopySourceAsHtml|TracExplorer|SQLyog|Chart Controls for .Net|SharePoint Designer|CodeRush Express
Coding Links: XPath|ConnectionStrings|VB and MySQL|MySQL Connector.Net|My.Settings
ADO.Net: MSDN Reference|Introduction|Using Access|Always use Parameters|Save and Retrieve Data - jm|An Explanation - jm
Code Bank Submissions: Code Snippets|Profile Provider|Serialization: C# VB|Restricted Menu|Compressed HttpWebRequest|Enumerate and Add Internet Explorer Favourites: VB C#|C# Tabbed Web Browser|Enhanced Tabbed Web Browser: VB C#
My Blog - View my MCP Certifications