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 8353631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:19:12+00:00 2026-06-09T09:19:12+00:00

In a C# MVC3 solution I’m passing the request.form as a string to a

  • 0

In a C# MVC3 solution I’m passing the request.form as a string to a webservice (I understand it would be much better to break it down and populate a model but it’s compromised with old code and mainly with time) and at a step the string is huge due to many options and failed in the service.

Actually I won’t need all of this options, which are basically several dropdownlists from which I just need one of them, so I’m trying to figure out how to change the request.form in order to remove the redundant ones and just keep the one selected.

To put this into context, this should be part of the string (just a middle chunk of it)

NG2BEF01-16344-181-E-16344-0-SHW_SHR*16344*MAT*1*2500*1600=0&NG2BEF01-16344-181-E-16344-0-SHW_SHR*16344*MAT*2*5500*6200=0&NG2BEF01-16344-181-E-16344-0-SHW_39S*16344*EVE*1*1500*0=2

And I would like to remove all of the options appart from (in this portion) the last one wich =2. This 0’s and the 2 come from a dropdown list which name is all the rest of the parameter (ie NG2BEF01-16344-181-E-16344-0-SHW_39S*16344*EVE*1*1500*0) although it may be completely different, not always follow this pattern.

Is there any way I can get rid of the dropdown lists I leave to 0 in the request.form before submitting (or even in the controller would be acceptable)?

  • 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-09T09:19:14+00:00Added an answer on June 9, 2026 at 9:19 am

    You could filter out values that you don’t want to keep:

    var values = HttpUtility.ParseQueryString("NG2BEF01-16344-181-E-16344-0-SHW_SHR*16344*MAT*1*2500*1600=0&NG2BEF01-16344-181-E-16344-0-SHW_SHR*16344*MAT*2*5500*6200=0&NG2BEF01-16344-181-E-16344-0-SHW_39S*16344*EVE*1*1500*0=2");
    string result = string.Join("&", values.Cast<string>().Where(key => values[key] == "2").Select(key => string.Format("{0}={1}", key, HttpUtility.UrlEncode(values[key]))));
    // The result variable will contain only kvps where the value equals 2
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm building a new Asp.Net MVC3 solution and would like to have all the
I have a ASP.NET MVC3 solution with 2 projects it in. Let's call it
I have two projects in my solution... a domain project and MVC3 web project
In my MVC3 solution I'm wondering how to move the logic that returns Json
I have tried to understand the MVC3 framework and when I used to start
I'm working on a MVC3 web-application and encounter a problem when passing values from
I'm working with a (.net4 / mvc3 ) solution file downloaded (from a reputable
I've been fiddling with some ASP.NET MVC3 solution structures and I have settled on
An architectural question. I've got a nicely de-coupled MVC3 solution with a few projects
In my solution I have an ASP.NET MVC3 project, and a WCF project that

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.