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

  • SEARCH
  • Home
  • 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 8536063
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T10:34:33+00:00 2026-06-11T10:34:33+00:00

Enviroment: Visual Studio 2012, MVC4, Razor, Internet Application. I have a code with search

  • 0

Enviroment: Visual Studio 2012, MVC4, Razor, Internet Application.

I have a code with search form in the “View” page…

@using (Html.BeginForm("SearchResult", "Home", FormMethod.Get))
{
    @Html.ValidationSummary(false)
    <fieldset>
        <legend>Contact Search</legend>
        <div class="editor-label">
            @Html.LabelFor(model => model.Name)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Name)
            @Html.ValidationMessageFor(model => model.Name)
        </div>
        <p>
            <input name="SearchButton" type="submit" value="Search" /></p>
    </fieldset>
}

And then I’m sending a “model.Name” string directly to the JavaScript code using “@Model.Name”.

The problem is… when I typing in the search form a quote (“) symbol… for example… (10” android) I have a problem. JavaScript stops work somewhere. How can I check this “model.Name” string inside the controller is it contains (“) or not and change it for JavaScript?

My JavaScript code… url += "&keywords=@Model.Name";
If “model.Name” is… 10″ android …will it work correct?

  • 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-11T10:34:34+00:00Added an answer on June 11, 2026 at 10:34 am

    For Javascript, I would encode with “escape”, but it is best practice to replace the ” (double) quotes with the XML representation &quot;

    As for server-side, I use Web Protection Library from Microsoft to handle that part,
    http://wpl.codeplex.com/

    Microsoft.Security.Application.Encoder.HtmlEncode(HttpUtility.HtmlDecode(dr[“message”].ToString()))

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

Sidebar

Related Questions

Enviroment: Visual Studio 2012, MVC4, Razor, Internet Application. I have a JavaScript array.. var
Enviroment: Visual Studio 2012, MVC4, Razor, Internet Application. I'm working with eBay API and
I think I may have accidently disabled stylecop in my Visual Studio 2008 enviroment.
We have a Visual Studio Wizard written using the DTE environment to automatically generate
I have Visual Studio 2008 Professional and when I click on menu View ->
Environment: Visual Studio Ultimate 2010 Windows XP WPF Desktop Application using .NET 4.0 We
Code written in C++ Environment: Microsoft Visual Studio I have a vector of maps.
The following code works fine in Visual Studio Development enviroment on my local machine.
I need to be able to target .NET Framework 4.0 using Visual Studio 2012
Enviroment: Visual Studio 2010, Windows Forms Application. Hi! I would like to rename (batch)

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.