MVC :: Obtain Url Query String During Json Request?

Sep 16, 2010

So I'm writing an MVC application, and have a JsonResult post back to obtain some item information for scanned items on a warehouse application I am writing. I'm trying to obtain a URL query string value though, and cannot seem to obtain one via the normal 'Request.QueryString['variable']' way... Is there a way to do this? I also thought about just passing the parameter into my post, but I already have a single value on my jquery post, and I am unsure if I can tack on more values to this.

View 7 Replies


Similar Messages:

Web Forms :: Length Of Query String For Request Exceeds Configured MaxQueryStringLength Value

Jun 16, 2015

Im getting this error while developing login page "The length of the query string for this request exceeds the configured maxQueryStringLength value".

View 1 Replies

Web Forms :: Cannot Obtain Request.ServerVariables From Thread

Aug 15, 2010

I am trying to run this log routine in a separate thread in order to improve page load performance but I am getting an error in the line bellow: "object not set to an instance of a variable".

line error: strTempBrowser = System.Web.HttpContext.Current.Request.ServerVariables["HTTP_USER_AGENT"].ToString();

I am suspecting that Request.ServerVariables are not available during the time that the thread executes. Is there a workaround?

Page Base Class
//STATISTICS
SiteStatisticsLite sStat = new SiteStatisticsLite();
Thread oThread = new Thread(new ThreadStart(sStat.AddLog));
oThread.Start(); // Don't wait to finish, just let stat logging to occurr after page loads
public class SiteStatisticsLite
{
//SiteStatisticsLite sStat = new SiteStatisticsLite();

View 2 Replies

C# - How To Obtain One Way Hash For Given String

Mar 10, 2011

Is there a build in library in .NET that can compute secure one-way hash ? I mean a library that implements SHA-2 cryptographic hash function or something similar.

If is there is no SHA-2 implementation some weaker hash funcion would be sufficient. If there are more options I prefer the most secure one.

provide a use example e.g. provide the code that returns one-way hash for string mySampleString.

View 3 Replies

How To Convert JSON String To JSON Object Using JavaScript

Jan 21, 2011

I use the JavaScriptSerializer class of ASP.net to serialize my object and return it to the client side. How can I deserialize the string using JavaScript?

View 4 Replies

C# - Converting Json String Into Json On Client Side?

Apr 4, 2011

In my javascript code I am getting json string from cs file

var tmpString="<%=resultset2%>";

In cs I am concatenating strings to build json string. Here is an issue the json string is returned as a string and it has " with it.

"[{id:'1',name:'Aik'},{id:'2',name:'Aik or Aik'}]"

Because of " in beginning and end javascript code treat it as a string.

View 2 Replies

C# - How To Simulate Http Request Using WatiN With Specific HTTP Referrer And Query String

Dec 6, 2010

When I use WatiN to go to a specific web page, how can I fake the HTTP referrer with a query string (i.e. request is from google search with query string q=search_term)? So I can verify that the response header has the 301 redirect for specific referrer URL.

View 2 Replies

C# - Serialize .NET Dictionary<string, String> Into JSON Key Value Pair Object

Feb 26, 2011

public class Package
{
public Package()
{
name = "";
type = new List<Dictionary<string, string>>();
}
public string name { get; set; }
public List<Dictionary<string, string>> type { get; set; }
}
[code]...

View 2 Replies

Json - MVC - Request Contents Of One Page From Another?

Mar 10, 2011

I have to write a page method in ASP.Net that returns a JSONP result. In order to build its payload for return however, it has to read a URL from another domain, passing it some parameters that were passed to it originally. I suppose I'll need to screen scrape the results to see if the login credentials worked. Could point me toward ideas that might begood for ASP.Net or ASP.Net MVC?

View 1 Replies

Jquery - Retrieve JSON Via Context.Request?

Aug 3, 2010

var OrderInfo = {
"ProductID": "ProductIDValue",
"ProductName": "ProductName",
"Quantity": 1,
"Amount": 9999,
"SLQuantity": 9999,
"SLDate": "08/03/2010"
};
var DTO = { 'OrderInfo': OrderInfo };
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "JasonHandler.ashx",
data: JSON.stringify(DTO),
dataType: "json"
});

I'm trying to retrieve posted JSON data on server side in an ASHX file via this code string strrequest = context.Request["OrderInfo"]; but it always return null. What Am I doing wrong?

View 4 Replies

Is It Possible To Make JSON Requests Using Fiddler's Request Builder

Apr 7, 2010

I keep getting a Request format is invalid.

Here's the raw http that get's sent:

[code]....

View 1 Replies

Creating A Jquery Grid From Json Data That Came Back From An Ajax Request?

Jul 7, 2010

i am searching for a way to create a grid (from some kind of jquery grid plugin didnt choose one yet)

anyway i want to call a webmethod and return a json serialized from a List of an object i created.

today i just use a regular grid view inside an iframe

but i want to eliminate that iframe and create those grids with ajax requests.

View 2 Replies

Query String Can A Query String Contain An Url That Also Has Query Strings

Nov 22, 2010

Example:

[URL]

I added the iis tag because I am guessing it also depends on what server technology you use?

View 3 Replies

JQuery :: Creating JSON Object From AD Query

Mar 23, 2011

I'm new to Jquery, JSON and MVC, and am trying to create a json object that contains AD info from an AD query. The ad query is working fine and returning data and I have 2 overloaded implementations of it.

#1 is a method from an older .net app that builds and returns a datatable that we bound to a grid view control

#2 was a modification of #1 that returns a System.Collections.Generic.List<> type. #2 returns data ok and i can display a table in the MVC view

however, I'd like to get the data results into a json object so i can bind it to a jqGrid object that has similar functionality to the old .Net server controls (Delete, Update, Sort) Here's the new method that's part of a C# static class:

[Code]....

Like I said...I'm new to this way of doing web development, so I'm not sure how to even approach getting this data into a json object.

View 2 Replies

Javascript - How To Make Json Child Nodes (JSON Inside JSON)

Aug 11, 2010

I try to use the jquery + json to get all elements in form and build a JSON var to post in a ASP.NET MVC method.

[Code]....

It method get all fields in a form and build a JSON, but it dont put JSON inside JSON.

Example:

If i have the follow form:

<input name="person.name"><input name="person.age"><input name="person.address.street">

The serialized string build a JSON like this

{ "person.name": "??", "person.age": "??", "person.address.street": "??" }

I need a plugin or some function to generate like this:

{ "person": { "name" : "??", "age" : "??", "address":{ "street": "??" } } }

View 1 Replies

How To Convert A JSON Constructed From Table To A Datatable For An Update Query

Jan 29, 2011

I would like to send json data from a HTML table to the ASP.NET code-behind and update the data in and SQL Server database. The code and JSON for the TableProductToUpdate() is below.

function UpdateProductTable() {
$.ajax({
type: "POST",
url: "Default.aspx/UpdateProductTable",
data: "{'products':" + JSON.stringify(TableProductToUpdate()) + "}",
[code]...

View 2 Replies

How To Read This JSON String

Nov 3, 2010

I am getting this JSON string from an ASP.Net webservice:

{"d":{"Table":[{"col1":123,"col2":"name","col3":"name","col4":100,"col5":"/Date(1153033200000)/"},{"col1":123,"col2":"name","col3":"name","col4":101,"col5":"/Date(1153033200000)/"},{"col1":123,"col2":"name","col3":"name","col4":102,"col5":"/Date(1153033200000)/"}]}}

In my jQuery how do I reference the Table code so I can loop through the data?

msg.d[i].col1
What am I missing? msg.d.table[i]?

View 4 Replies

MVC ::name Each Linein C# A Json String?

May 23, 2010

have to create, in c#, a json string, something like that:

[Code]....

Mymajor problem is that I don't know how to name each line,what I get is that?

View 2 Replies

State Management :: How To Pass Dynamic String Through Query String With Java Script

Dec 24, 2010

I m facing some problem. i m not passing Dynamic string through query string..

I m using this code

string abc = "CPCB_" + TextBox1.Text + "_" + TextBox2.Text;

Response.Write("<script>window.open('xml.aspx?Flag=3&date='+abc,target='new');</script>");

View 2 Replies

How To Convert JSON String To Object In C#

Oct 7, 2010

If I have a string containing valid JSON

how can I convert to an obect in c#?

View 2 Replies

Get Only JSON String As Output Without Any Html

Jan 22, 2011

I am developing a webiste in ASP.NET. On one of the pages page named menu.aspx, with the help of a certain login, I am getting the output in this format

foo({"1":"Jeff","2":"Mik","5":"Tom"});

I am using this code to get the output on the JSON form.

[Code]....

However, I must get the output only in simple JSON on the page without any HTML.

For eg: Here's the screenshot showing the source of the output page. [URL]

Notice that it has only the JSON string as the output.

And here's the screenshot showing the output page source (with HTML). [URL] .This HTML is what I have to remove. How can do I do this? The full code of menu.aspx.cs is putup here. [URL]

View 3 Replies

C# - Create JSON String From SqlDataReader?

Apr 4, 2011

I'm using Json.NET and I'm trying to create a JSON string representing a row from a database table to return in an HTTP response. I'm not sure how to do this while I'm reading from the database.The problem is marked by the obnoxious comments /******** ********/

// connect to DB
theSqlConnection.Open(); // open the connection
SqlDataReader reader = sqlCommand.ExecuteReader();

[code]...

View 1 Replies

C# - Escaping Quotes In Json String?

Aug 12, 2010

System.Web.Script.Serialization.JavaScriptSerializer s = new System.Web.Script.Serialization.JavaScriptSerializer();
result = s.Deserialize<Hashtable>(data);
Error is thrown if data is "{a:""test" 123",b:"hello" }"
No error is thrown if data is "{a:"test 123",b:"hello" }"

How do I adjust the data string so that no error is thrown even when there are quotes?

View 1 Replies

JSON Serialization Of C# Enum As String?

Mar 14, 2010

I have a class that contains an enum property, and upon serializing the object using JavaScriptSerializer, my json result contains the integer value of the enumeration rather than its string "name". Is there a way to get the enum as a string in my json without having to create a custom JavaScriptConverter? Perhaps there's an attribute that I could decorate the enum definition, or object property, with?As an example:

enum Gender { Male, Female }
class Person
{

[code]...

View 2 Replies

Convert A JSON String Into JsonResult?

Apr 21, 2010

I have some stored JSON strings stored in the DB which I want to return to the client as JsonResult . I know that Json(object) turns an object into JsonResult but what if I already have the result in a string ? can I cast it to JsonResult

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved