.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Obtain url query string during Json request

Posted By:      Posted Date: September 16, 2010    Points: 0   Category :ASP.Net
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. Thanks for your help.

View Complete Post

More Related Resource Links

How to Encrypt Query String Parameters in ASP.NET

Encrypt Query String Parameters in ASP.NET.u can send secure data one page another page u can also use query string to encrypt

How to send an email with information in query string


First I will say I googled (Binged to make Bill happy) for this but could not find anything, perhaps I am not stating what I need correctly;

I have a website that a customer creates orders (for a printing company) and after the order, I would like to email the customer a link to view the status of their order;

I need to send the CustomerID in the link so on the returning page if a CustomerID is detected in the querystring, I "auto login" the client and open the "Dashboard" for the order page for that customer.

Can anyone point me in the right direction as to how to send the link and how to parse the querystring to get the values from the link;

Thank you if you can point me in the right direction.

Getting URL without Query String

Is there an easy way to get the URL portion without the query string of a given URL?

E.g. http://www.abc.com/?a=b&c=d --> http://www.abc.com/

adding parameter to query string


hi all,

how do i add a new parameter to an existing query string?


now i need to add a new parameter say, showsearch.

RegEx Request - Extract an tag from string...

Hello, Can anyone give me a regular expression that will extract the <img> tag from a string.  I am receiving descriptions from an rss feed and the description contains an <img> tag in the text.  I want to extract the <img> so that I can display it in a different location on my page. I have fooled with some regular expressions, but my knowledge of them is not very good. Thanks in advance for any help!!

query string or session variable or neither for this scenario?

Hello,example scenario: user login has a list of associated 'accounts' it has access to... this list of accounts is stored in a database table, say tblAccountAccessControl, something like:login, accountID-----------------------userA, account123userA, account456userA, account798userB, accountABCuserB, accountDEFetc..this info is used throughout the web application and determines the 'domain' of information the particular login has access to. For example there are many other tables that have the 'accountID' field and whenever a page pulls data from the table it only pulls data that the currently logged in user should be allowed to see, based on that tblAccountAccessControl data.the security question:1) do I need to query the database every time I need to get this list of allowed accountID's? I was about to use a plain old query string to pass a particular accountID to another page but quickly caught myself as I realized that would be a major security flaw (the receiving page was going to use that accountID to grab info from the database, and there would be nothing preventing a user from simply typing in a url manually to get data from an accountID they are not supposed to be allowed to view). So I then thought I'll just store the list of accountID's in a session state variable so they will be carried with the user throughout the sessi

I want to encrypt the query string appearing in the URL

I want to encrypt the query string appearing in the URL when pass to other page. For Example: I have a Hyperlink column in GridView  when I click on the link, I pass a parameter to another page. This parameter should not be displayed in the URL as a true value but encrypted. Any help will be most appreciated.  If possible, please provide example. Thank you.  

Pass XSL "Currently Selected" Value via Query String

Hi, I have a DVWP with an ID column, that's connected to other webparts on the page to filter their values accordingly.   I also have a "Print" button that opens a custom ASP page that's essentially a print-friendly single item data view.  How do I pass the "selected item" value to the URL when a user hits the print button? I've already set up the "ID" parameter and filters on the target page, just need to know how to get the value info from the list ID field inserted into the URL upon button click.  Thanks in advance

Duplicate URLs in Source Parameter of Query String for All SharePoint Lists

After performing a database attach method of upgrading our existing web application from MOSS 2007 to SharePoint Server 2010, all of our lists that migrated now exhibit an interesting but undesirable behavior.  The DispForm.aspx and EditForm.aspx pages that get loaded are given the Source parameter of the query string but instead of the URL being a single entry like: Source=http://sharepointsite.domain.com/Pages/Default.aspx It winds up putting the URL twice like this: Source=http://sharepointsite.domain.com/Pages/Default.aspx,http://sharepointsite.domain.com/Pages/Default.aspx Naturally this makes processing of the form -- either by choosing OK or Cancel buttons -- result in an HTTP 404 error.  The question we're left with is how in the world did the Source parameter get set that way to begin with.   It wasn't that way in 2007. We had thought that perhaps there was something that didn't migrate over correctly for the existing lists, so I tried creating a new list and then added a new item to the list.  So far so good.  Then attempted to Edit Properties or Edit Item or even View Item, etc. -- essentially triggering the load of the EditForm.aspx and DispForm.aspx  -- and we received the 404 again.  At this point we're not sure what's going on or how to fix it.  We've performed the migration three times so far with t

Need Help in HyperLink with query string

Dear All,         I am using a hyperlink which Navigation Url is like                                                                     Indus.aspx?Ind="+indName+"&Value="+val  The indus page is not getting reloaded (There is one grid, whose rebind is not happening) and even i tried debugging. But it seems not entering the page. So i want to trigger a page load in query string . thats my only catch in this issue. are there any thing which cud be appended at the end of the above link to trigger a page reload? Please give your suggestion people.   Thanks in advance, Parthiban S.

How to filter managed meta data column using page query string?

I have two managed term sets as follows: Articles:Downloads Projects:Downloads I am trying to use a content query web part to filter a list based on the above manged meta data column. I want to filter out only "Articles:Downloads" Scenario 1: When I edit the web part and directly set the filter option with the managed meta data column to "Articles:Downloads" it works fine. When I export the web part, in the .webpart file, the "FilterValue1" property has a value "Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910". Scenario 2: I want the web part to get the filter information from query string [PageQueryString:pageType]. So I tried using these options: a) pageType=Downloads      This works but returns downloads under 'projects' as well. (i want downloads only under 'articles')  b) pageType=Articles:Downloads     Does not work and shows no records c) pageType = Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. (This value is the same as one found in 'FilterValue1' of the static web part). c) pageType = Articles:Downloads|9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work. d) pageType = 9096e43b-555d-4879-9acc-b4ada9ea9910     Does not work.   What am I missing here? Can some one please help?

Need to Change a Query String in a DataSet

I need help in pointing me in the right direction...   I have a microsoft Report (ViewDelete.rdlc) that is feeding from a DataSet(ViewDeleteDataSet.xsd). A Web Form has been created with 3 Textboxes: -Search by VehicleNr -Search By VIN -Search By TagNr The Same Web Form as Microsoft ReportViewer loading the above mentioned report.   What Needs to Happen: 1. User entered search information into one of the textboxes and clicks Search 2. Query string for the Report is updated to list only the information the user is wanting to see and reloads the report based on this query.   I have been searching for about 4 hours with no luck on how to do this.  I maybe way off on how this should work, can someone help get me going?

Query Correlation faliure using custom Request/Reply Message Contract classes.

Hi,I have a service which is correlated by a Guid query. When I'm using designer created Message Content/Parameters feature for message definition, everithing working lika a charm. But If I define custom [MessageContract] Request/Reply classes (where request class has Guid SvcUID property for correlation), and choose'em as Message Content in the designer with proper CorrelatesOn definition of course, I have got a service exception about correlation query faliure. Have you folks tried to apply your custom [MessageContract] classes for correlated communication?

xml nodes query on DataContractSerializer string

Hi I need to get a table from this xml, I have some experience using nodes but am getting nowhere on this string.  It is produced from DataContractSerializer on a list with one of the columns a dictionary.  Any help will be much appreciated!  declare @xml xml = ' <ArrayOfArmorDeviceBase xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://server.armor.com/contract/data">   <ArmorDeviceBase xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/" z:Id="i1" i:type="ArmorSimpleDevice">     <Id>5000</Id>     <SiteId>0</SiteId>     <SourceSystem>Armor</SourceSystem>     <DataGroups xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">       <d3p1:KeyValueOfstringDeviceDataGroupBaseRRFhSxY9>         <d3p1:Key>CommunicationStatus</d3p1:Key>         <d3p1:Value xmlns:d5p1="http://server.armor.com/contract/data/ControllerStatus" i:type="d5p1:CommunicationStatus">           <Ticks>0</Ticks>           <d5p1:Status>Disco

Need to convert query string(date - 09/15/2010) to a text format - yyyymmdd

I am fairly new to C # and need some assistance with a form page.  I have created a simple form that requires the user to select a beginning date and ending date.  I then pass the values to my code behind page via query strings.  I have them passing, but I need the format to be change to a different format.  Unfortunately the database does not use the standard date format.  It requires the date to be in a text format as YYYYMMDD.Form: <tr> <td> Beginning Date:</td> <td><asp:TextBox runat="server" ID="begDate"></asp:TextBox> <asp:Image ID="Image2" ImageUrl="~/images/calendar_schedulehs.png" runat="server" /></td> </tr> Code Behind: protected void createReport_Click(object sender, EventArgs e) { StringBuilder url = new StringBuilder("Report/TopCustomer.aspx?"); url.Append("BegDate=" + begDate.Text); url.Append("&EndDate=" + endDate.Text); url.Append("&Brnch=" + ddlLocation.SelectedValue); Response.Redirect(url.ToString()); Current URL: TopCustomer.aspx?BegDate=09/15/2010&EndDate=09/30/2010&Brnch=300I need to have the above URL change to:TopCustomer.aspx?BegDate=20100915&E

How to apply dynamic filter in Datasheet View from Query String

The datasheet view doesn't support either connections/dynamic filters from Query string. How to filter the data using query string?

How to Catch Bad JSON Request Payload in REST using WCF3.5

Hi, I'm using WCF 3.5 REST with JSON output. If I send the below request body {"persons": [{"fname":"John"}, {"fname":"sheena"}} to my web API, my REST service throws "500 - Internal Server Error". If you look at carefully, request is missing the ending square bracket & hence the error comes. Now, I would like to know how to catch this error??? So, far I've no luck in catching this error at all. I need to give 400 Bad Request error instead. How do I do that? Thanks!
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend