Contents tagged with Razor

  • 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="">Home</a> …

    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