Contents tagged with MVC

  • ASP.NET MVC Relative URL for Homepage

    ASP.NET, MVC, Razor, Programming

    It has been awhile since I worked with ASP.NET MVC due to work and many other activities, but I wanted to get back into it since I have always loved programming.  One of the first issues I ran into when publishing my site was a pretty simple one, I needed to change the menu button for Home to link back to the root of the site.  Very easy and basic to do, I could just hard code the root of the site into the HTML, i.e. 

    <a href="http://www.suhokdesigns.com">Home</a> …

    Read more 

  • Creating Custom Brush for SyntaxHighlighter

    ASP.NET, MVC, Syntax Highlighter, Custom Brush, Programming, JavaScript

    I wanted to have nicely formatted blocks of code for my site blog since a lot of the articles will be code or development related.  I found a really nice JavaScript plugin called SyntaxHighlighter by Alex Gorbatchev to make this easier.  It uses "brush" files to set up the language features, such as how comments start and end, what keywords are available to that language, how strings are formatted, and much more.  Each brush uses a lot of regular expressions to set up the …

    Read more 

  • Customizing Body Summary in Orchard

    ASP.NET, MVC, Razor, FontAwesome, Orchard, HTML

    In Orchard, the content summaries are displayed with a limit of 200 characters and a default "more" link after the body summary.  I felt the summary length was much too short, and I wanted to customize how the "more" link was displayed using an icon in the link.  Surprisingly the first part was quite easy, it was the latter part that took a bit more effort to tweak.

    I found the file where the summaries were being created, it exists in the Orchard.Core/Common/Views/Parts.Common.Body. …

    Read more 

  • ASP.NET MVC Accepting HTML Input from View

    ASP.NET, MVC, Razor, HTML, ValidateInput

    By default, ASP.NET will not allow any HTML or JavaScript tags to be entered as text for an input field. It will throw an error stating:

    "A potentially dangerous Request.Form value was detected from the client..."

    This is a built-in security mechanism to prevent Cross-Site Scripting (XSS) or other forms of injection attacks. However for my blog, I needed to be able to accept HTML tags for the blog posts, so I did some research and found two primary ways around this problem.

    [ValidateInput( …

    Read more 

  • 1