Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7713239
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T01:49:30+00:00 2026-06-01T01:49:30+00:00

I have an ecommerce gift store where users can fill out a gift-card for

  • 0

I have an ecommerce gift store where users can fill out a gift-card for their recipient.

In order to fill out the card, I have the users enter text into a multiline textbox.

When I display the gift-card on the final review page, I have to spit out the information with Html.Raw so that Newlines are being displayed properly. I’m doing this:

@(Model.GiftCard.Text != null ? Html.Raw(Model.GiftCard.Text.Replace(char.ConvertFromUtf32(13),"<br />")) : Html.Raw(""))

I’m frightened that i’m entering dangerous territory using Html.Raw on values that were user-entered. However, when I go back to the gift-card entry page, the page breaks when I try to do something like “This is my gift card! (scripttag)alert(‘test’);(/scripttag)”… so I feel like .net will catch any malicious entries during that point.

Am I safe to proceed like this? It seems that since the gift-card entry page is running validations against malicious code, I should be okay to use HtmlRaw later to display newline html that I’m putting in myself…

(I replaced the actual script tag with this (scripttag) thing above so it will show in stackoverflow)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T01:49:32+00:00Added an answer on June 1, 2026 at 1:49 am

    Use a regular expression in your view model to make sure people only enter A-Za-z0-9 and whatever else you think should use such as 🙂 =] type of stuff. Screening this stuff front end is better than second guessing it on the way out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple ecommerce type site that will have users with accounts, orders,
I have a task to optimize search engine in asp.net ecommerce store based on
I'm currently building a simple ecommerce site and have ran into an interesting problem.
While building an ecommerce platform I have run into design problems. I'm working with
I have an ecommerce site and a product can have three variants. This is
I have an ecommerce store that I am currently working on and there are
Have an ecommerce site running ZNode. We send tax, shipping, order total, etc. Everything
I have an ecommerce MySQL database that stores order information in the table 'orders'
What would be best practice for the following situation. I have an ecommerce store
I have an admin area in an ecommerce website whereby the admin can view

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.