I am working with Yahoo map in asp.net MVC .I want to show pushpin and load map with latitude and longitude saves in database.I am using following jQuery script
I try to get parse JSON response for the following link: https://graph.facebook.com/feed/?ids=135395949809348,149531474996&access_token=
The response is like that: { "135395949809348": { "data": [ { ....Some data }] } , "325475509465": { "data": [ { ....Some data...... }] } }
I use System.Web.Script.Serialization.JavaScriptSerializer.Deserialize(string json) method. But the objects key names always different , so I can't define the class that can be used for parsing this response.Is anyone has any experience in parsing multiple id's response from Facebook?
I have a project in ASP.NET MVC1 using VB.NET controlers and JqGrid. it works fine under MVC1. After migrating the project to ASP.NET MVC2, the grid is no longer populated. It seems that there is some new restrictions on returned Jsonresult in MVC2. How to solve this in VB.NET. Controler function populating the jqgrid is something like this :
Function GetGridRecordset(ByVal qry As String) As JsonResult Dim result = New JsonResult() ... ... Return result End Function
I am new to WCF, I was using web service asmx before. I have trouble on making my wcf JSON ajax service work through http like asmx.Could you help me see what wrong in my code?My WCF services are defined in my website application folder. My aim is to call this service in my aspx page java-script code and return complex object back as JSON to my javascript. I have no problem on doing this through classic asmx web service.
When I try to test it through my browser by type this in the URL , URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc/GetAll. it return "Method not allowed."
But if I type just this URL-http://localhost:3849/WebServices/Account/WCFCompanyService.svc, it return this:
WCFCompanyService Service
You have created a service.To test this service, you will need to create a client and use it to call the service. You can do this using the svcutil.exe tool from the command line with the following syntax:
This will generate a configuration file and a code file that contains the client class. Add the two files to your client application and use the generated client class to call the Service. For example:
C#
class Test { static void Main() { HelloClient client = new HelloClient();
I have a text file named gisQuery129.json that is created using Json.NET - [URL] There is an example on how to create a JSON file and I have done that successfully, but I want to read the file on a page load event and add the values to .NET textbox controls for input values in a query. The created file looks like the following:
{ "myData": { "randomNumber": "129", "Application": "MyMapApp", "FeatureId": "ALL", "Feature": "ALL", "spatialQuery": "FEATURE_ID= '11111' AND REQ_SEQ_NUM= 1 AND RAND_PARAM= 129 OR FEATURE_ID= '22222' AND REQ_SEQ_NUM= 2 AND RAND_PARAM= 129" } }
I want to read the data in the above sample JSON data and then populate my textboxes something like this:
txtRandParam.text = "129" txtApplication.text = "MyMapApp" and three more text boxes after that.
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?
I've been tasked with implementing a JSON feed on an asp.net website that will be consumed by 3rd party apps (such as IPhone, Android, etc) and I'd like to follow best practices.
An example of what I'd like to achieve would be something similar to: [URL]
I've chosen the JSON.net api as this seems to be highly recommended.
My Google-fu must be failing me as I can't find a single full example code for an Asp.net web application with JSON.net implemented on it, so I've no real concept of where to begin.
My question is fairly simple:
Should I create this sort of feed as an ASPX, or ASHX file? Or even a .NET Web Service? (Remember that the tools that will be using this feed are on external apps like IPhones, etc)
I created a test feed in both ASHX and ASPX format ... here is the code (I'm using Subsonic to populate the collection) ... are either of these along the correct lines?
<link> <linkto>[URL]/broadcasts/index.cfm?fuseaction=usrbrd&broadcasterid=57468</linkto> <image>report_button</image> <alt>Report a Problem</alt> <target></target> </link> <linkto> tag have the url. But because of the "&" symbol in the url thats completely crashing the page. I tried using like amp; next to the & symbol but this doesn't give the correct url.
I am in trouble. I have a asp.net file and publish it and run in localhost. [URL]. Its working fine.
But i put the file in mob server(It's the own server we are using in my concern)[URL] its not working. I got an error message that is
XML Parsing Error: not well-formed Location: file://///Mob/mdirectalpha/CPWebserviceAlpha/Addons.asmx Line Number 1, Column 2:<%@ WebService Language="C#" CodeBehind="~/App_Code/Addons.cs" Class="Addons" %> -^
Is it the problem in server? I need to set any settings in server?
I'm developing a small ASP.NET Mvc project in Mono 2.4, Ubuntu 10.10. There is an array of objects, each one of them corresponds to a certain xml file. Reading of the xmls is performed with XmlTextReader. That does not work because xml files have rare "cp866nav" encoding, which is not supported by XmlTextReader ("System.ArgumentException: Encoding name 'cp866nav' not supported"). But it works fine if encoding in xml header is changed to "cp866". I found a kind of solution which consists in initializing XmlTextReader with a StreamReader with a certain encoding instead of file name, like in the code below:
XmlTextReader reader = new XmlTextReader(new StreamReader(Server.MapPath(filename), Encoding.GetEncoding("cp866")));
The issue is that the directory which contains xml files is read only (I can not change it), so I get "System.UnauthorizedAccessException: Access to the path '' is denied.". Rather strange, because XmlTextReader initialized with a filename seems to read the files. Is there any solution, considering that program cannot modify or create files?
I'm working on two pages using VB. The 1st page have a textbox to key in the names. And the 2nd page will have a label to display the text thats entered in the previous page.
I have a ViewModel class: "MainPage" which contains 2 properties: Title, Id.I have a controller which prepares a list of MainPage and sends it to the view:
public ActionResult SideMenu() { MainPageDal dal = new MainPageDal(); DataTable dt = new DataTable(); dt = dal.GetArticlesList(); List<MainPage> mainPageList = new List<MainPage>(); MainPage mainPage; foreach (DataRow row in dt.Rows) { mainPage = new MainPage(Convert.ToInt16(row["Id"]), row["Title"].ToString()); mainPageList.Add(mainPage); } return View(mainPageList); }
In my view I do: <% foreach (var mainPage in Model) { %>
Now I added "List<String> myList=new..." into my MainPage class and tried to do foreach like this:
Why I can't do: <% foreach (var str in Model.myList) { %>
myList is a list of string inside MainPage.The error I get is:
c:devMvcTestMvcTestViewsHomeSideMenu.aspx(12): error CS1061: 'System.Collections.Generic.IEnumerable<MvcTest.ViewModels.MainPage>' does not contain a definition for 'myList' and no extension method 'myList' accepting a first argument of type 'System.Collections.Generic.IEnumerable<MvcTest.ViewModels.MainPage>' could be found (are you missing a using directive or an assembly reference?)
when my xml file is big, I get the following error unexpected end of file while parsing name has occurred. Line 1, position 2034 the xmlData debug showed that not all the xml file is being read
[Code]....
I read that the memory of the string variable is not big enough to handle the xml file, what can I use to be able to read big xml files. my program works for small xml text.
I am building a website and recently I had to format my re-install everything on my lappy..before that the site was working very good locally..but after re-installing VS2008 I don't know why I keep getting this error
XML Parsing Error: no element found Location: [URL] Line Number 1, Column 1:
I searched online..and found out that the reason might be some unclosed HTML tag but I checked and made sure that all the tags are properly closed..I also added Response.ContentType = "text/HTML"into .cs files in Pge_Load method..but I am still getting that error..I have one master page and two pages rendered using it..I dont understand how come the same program works once and after re-installing VS it doesn't work I dont know if this will help or not but master page starts with these 3 lines
I'm breaking my head over this for a while now and I have no clue what I do wrong. The scenario is as followed, I'm using swfupload to upload files with a progressbar via a webservice. the webservice needs to return the name of the generated thumbnail. This all goes well and though i prefer to get the returned data in json (might change it later in the swfupload js files) the default xml data is fine too.
So when an upload completes the webservice returns the following xml as expected (note I removed the namespace in webservice):
Now I want to parse this result with jquery and thought the following would do it:
var xml = response; alert($(xml).find("string").text());
But I cannot get the string value. I've tried lots of combinations (.html(), .innerhtml(), response.find("string").text() but nothing seems to work. This is my first time trying to parse xml via jquery so maybe I'm doing something fundemantally wrong. The 'response' is populated with the xml.
i have a asp.net web application and i need to take a full Directory path (for ex: http:\<server><websitename>folder1 est.lst) and parse the name of the folder that has test.lst file. The directory tree can vary and i just need a generic way to parse this path and find the directory name which has the file.
I have a WCF Web Service that my ASP.NET app uses. It has been working fine for quite some time. I just added in a Dev Express Grid (and the Dev Express DLLs) and a new page that uses them and now I am getting parsing errors on the WSDL. But the weird part is that it works fine on my machine but fails on the web server machine. (Both are connecting to the same web services WSDL.) Here is the error message I am getting:
Server Error in '/MyWebAppWebDev' Application.
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Reference.svcmap: Failed to generate code for the service reference 'MyWebAppService'.
Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Referenced type 'WebClientApp.MyWebAppService.ReferenceUpdatesDataContract, WebClientApp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' with data contract name 'ReferenceUpdatesDataContract' in namespace '[URL] cannot be used since it does not match imported DataContract. Need to exclude this type from referenced types. XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:portType[@name='IMyWebAppReferenceDataServiceLib'] Cannot import wsdl:binding
Detail: There was an error importing a wsdl:portType that the wsdl:binding is dependent on. XPath to wsdl:portType: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:portType[@name='IMyWebAppReferenceDataServiceLib'] XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]/']/wsdl:binding[@name='MyWebAppServicesDefaultEndpoint'] Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on. XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='[URL]wsdl:binding[@name='MyWebAppServicesDefaultEndpoint'] XPath to Error Source: //wsdl:definitions[@targetNamespace='[URL]wsdl:service[@name='MyWebAppReferenceDataServiceLib']/wsdl:port[@name='MyWebAppServicesDefaultEndpoint']
I am completely stumped on this. I have checked my web.config endpoint address and it is spot on (and notably is not in the error message above).
Things I have tried:
Giving permissions to C:Windows emp to my Website user name Giving permissions to C:Windows emp to my App pool user name Checking to see that none of my data contracts are generic and have IsReference=true in them.
I wanted to write a regular expression using the ASP.Net RegExp validator that would ensure a field contains only numeric and decimal values, and at least one character.
^[0-9]{1,40}(.[0-9]{1,2})?$
Essentially: [0-9]{1,40} - meaning at least one to 40 numeric characters.The ASP.Net regexp validator does not fire for an empty field - where there is not at least one character.