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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T08:57:46+00:00 2026-05-19T08:57:46+00:00

Here’s my issue: Client(s) give me separate JS files which will run a check

  • 0

Here’s my issue:

Client(s) give me separate JS files which will run a check of some sort on the user’s system (Browser type, are cookies enabled?, etc.) and a list of acceptable values to be returned from this check.

I want to run through each JS file when a user visits the site and compare the results to the list of acceptable values, then alert the user if they pass these requirements or not.

I’m currently using RegisterClientScriptBlock() to add the JS to the client’s page, so it’s being run, but I’m having issues getting the result value from the JS back to ASP.NET in order to do the comparison.

I’ve tried using hidden fields that the JS will dump the value to and ASP.NET will read from, but I’m having difficulty generating the hidden fields on demand (since I have no idea how many Js files the client could have) and have them work in the ASP.NET code.

Any help, or suggestions in the right direction would be awesome, thanks!

  • 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-05-19T08:57:47+00:00Added an answer on May 19, 2026 at 8:57 am

    What I would do is have the results be an array of KeyValuePair objects that you would then serialize to JSON. So you create the javascript object type like so:

    function KeyValuePair(key, value){
         this.Key = key;
         this.Value = value;
    }
    

    Then you would build up an array of KeyValuePairs like so:

    //This array is declared in the global scope 
    var ValueArray = new Array();
    
    function someFunction(){
       //this assumes that the key and value variables are created earlier in the function
       var valueToStore = new KeyValuePair(key, value);
       ValueArray[ValueArray.length] = valueToStore;
    }
    

    So at the point when you are done with all your checks you would use the json2 serializer to serialize the array to json for storage in your hidden field.

    var jsonToSaveToHiddenField = JSON.stringify(ValueArray);
    //Logic to store resulting json and trigger the serverside evaluation here
    

    On the server side you would use JavascriptSerializer to deserialize your json to an array of KeyValuePairs. Here is the msdn doc on that: JavaScriptSerializer Class Reference

    So with this approach you only need one hidden field. So you don’t need to dynamically create it which should simplify the server side retrieval quite a bit.

    The above should work with minimal changes however I haven’t run this through a compiler so there might be some minor syntax errors preset.

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

Sidebar

Related Questions

Here is the issue I am having: I have a large query that needs
Here is my code, which takes two version identifiers in the form 1, 5,
Here is the scenario: I'm writing an app that will watch for any changes
Here's the issue... if I use, say a directory catalog in MEF and have
Here's a basic regex technique that I've never managed to remember. Let's say I'm
Here's a problem I ran into recently. I have attributes strings of the form
Here's my scenario - I have an SSIS job that depends on another prior
Here is a simplification of my database: Table: Property Fields: ID, Address Table: Quote
Here's a coding problem for those that like this kind of thing. Let's see
Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE

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.