Xml - Serve Up A Resource As Both JSON And Aspx With OpenRasta?
Mar 29, 2010
I've been using OpenRasta to convert an old web application we have into something RESTful. IS it possible to serve up a resource (or
specifically a list of resources) as both .aspx and JSON? I have tried this but no matter what I try I keep getting the .aspx back .. Here's a sample configuration:
ResourceSpace.Has.ResourcesOfType<List<Valueset>>()
.AtUri("/valuesets")
.HandledBy<ValuesetHandler>()
.AsJsonDataContract()
.And.AsXmlDataContract()
.And.RenderedByAspx("~/Views/VauesetView.aspx")
View 1 Replies
Similar Messages:
Jun 17, 2010
we're in the process of trying to speed up the performance of our website by serving static content from a cookieless domain. That seems to be going well, but I have a new question:
I know that it's "static content" that we're talking about when serving it from a cookieless domain, but we also have static content being served by ASPX pages, specifically images. For example:
domain.com/resizeImages.aspx?src=images/image123.jpg&width=400&height=400
How can I serve the resizeImages.aspx image without ASP.NET setting a cookie on my browser? (At present it sets an ASPXANONYMOUS cookie.)
View 1 Replies
Nov 27, 2010
I have with working with Visual Studio for a while, and using it's web server. I decided I needed IIS 7 for testing certain features. I installed, but I get an error
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME mapI've googled and been able to figure out that aspx pages are not enabled by default, but I can't find the proper method to fix this.
View 2 Replies
Aug 13, 2010
Is there a preferred way to configure an ASP.net solution so that OpenRasta can run alongside an existing application asp.net application.
I'm interested in what the process would be for a request coming in to the server for:
a resource OR knew about
a resource the old web app knew about
a resource neither app know how to handle
I'd like to keep the 2 projects separated so that we can gradually move over functionality to being based on OpenRasta and away from our legacy app.
As an example, on a machine with a virtual directory of /api
Requests to /api/contacts <-- handled by OpenRasta.
Requests to /api/v0.1/contacts <-- handled by Legacy web app.
Requests to /api/junk <-- handled by Neither web app.
View 1 Replies
Feb 24, 2011
I am able to display Customer records, but when I click on the details link to retrieve related orders, I am getting Resource not found error as shown below.: I can email to you my solution project to help make things clearer.I have added my code for CustomerController class
using
System;
using
[code]...
View 4 Replies
Mar 3, 2010
Say I got this .aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MyPage.aspx.cs" Inherits="MyPage" %>
<script type="text/javascript">
//<!-- I want to inject a JSON string here, which is generated per side-request -->
function doStuffToMyData(){
// .....
}
</script>
how I can inject a JSON string here? I got no problem generating the string, or parsing it in the browser..
It could be there's an easier way to do this? I basically want to manipulate the looks of the side, depending on changes to this data, so I figured it would be easiest to have the data as a JSON string.
View 2 Replies
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
Jun 17, 2010
I have an ASPX page that I am using to write JSON. It works great in Firefox and Chrome, but when I try and use it in IE 8 it gives me an "The XML page cannot be displayed" error instead of allowing jQuery to load the JSON being written by the response. Here is what my code looks like:
protected override void OnLoad(EventArgs e)
{
Response.Clear();
Response.ClearHeaders();
Response.ContentType = "application/json";
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Write(string.Format("[ {{ "Foo": "{0}", "bar": "{1}" }} ]", "Foo Content", "Bar Content"));
Response.End();
}
View 3 Replies
Jun 21, 2010
i built contact form in aspx 3.5 and i'm using jquery to send it to web service (asmx).the web service need to return success or error code. the problem is that at the web method i get only single value and not array. I'm kind of new in ajax and i tried a lot of solutions but without any results.. please if you can only explain me the principle of what to do it also be good..this is the client side:
$(document).ready(function()
{
$("#submit").click(function(event)
{
[code].....
when i debug i see that the input parameter "name" contains only one string - i dont know how to get the full json string that i send to the service and contains all the form data - i want to desirialize it to string array or something like, and process it.
View 2 Replies
Nov 27, 2010
My Problem is that i am returning a json string from a webmethod from an aspx page.
I want to create a dynamic html table using that json string but found no solution for that.
Can anyone Provide me the solution to generate html table from json string ?
View 6 Replies
Jan 12, 2010
How can I use an image or icon resource from global resource file in an asp:Image control to set the ImageUrl attribute?
View 1 Replies
Jun 2, 2010
I will be setting the current thread's culture at the beginning of the request lifecycle.
Does it make sense if I create my own resource.xml to store things like strings/labels/messages that will be used in the web application?
or are their drawbacks and its better if I just use the Global resources .resx files that are 'built-in' ?
View 2 Replies
Apr 7, 2010
In our web application we need to keep various company's settings. For eg "DiamondProdRefIDCaption","Shippingpickup","ZipCodeCaption","DefaultCountry","AllowToEditInvoice", etcThese settings are different for various companies and are placed in web.config as key-value pair.Initially, we have tried do simplify this process by adding a company_settings table in the DB so as to allow us to add companies on the fly. However, this method makes it very difficult to add a new setting
<%$Resources:DiamondProdRefIDCaption%>
View 3 Replies
Jul 3, 2010
I am using JQuery & JSON (POST) to call webmethod. However I can call only webmethod located at aspx file but not in asmx file Below are sample codes
CustomValidate.asmx
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.ComponentModel
Public Class CustomValidate
Inherits System.Web.Services.WebService
'ACCESS VIA JSON
<System.Web.Services.WebMethod()> _
Public Shared Function AJAX_Test(ByVal date1) As Boolean...
Return True
End Function
End Class
Javascript: JQuery JSON
function isDates(source, arguments) {
var isValidDate;
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "CustomValidate.asmx/AJAX_Test",
data: '{date1: "' + arguments.Value + '"}',
dataType: "json",
async: false,
success: function(result) {
isValidDate = result;
},
error: function(httpRequest, textStatus, errorThrown) {
alert("status=" + textStatus + ",error=" + errorThrown);
}
});
arguments.IsValid = isValidDate;
}
It always return javascript undefined error. But if I put the AJAX_Test webmethod in aspx page and replace the url: "CustomValidate.asmx/AJAX_Test" to "mypage.aspx/AJAX_Test". It works fine.
View 1 Replies
Dec 29, 2010
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.
View 4 Replies
Feb 1, 2010
I want to retreive the data from database and assign it to dropdownlist. For that I'm using the following jquery in the onclick event
[Code]....
View 1 Replies
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
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
Nov 18, 2010
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?
ASPX:
[Code]...
View 2 Replies
Jun 18, 2010
I'm referencing the css at the top of my CompositeControl
[assembly: WebResource("MyAssembly.styles.main.css", "text/css")]
...but how do I actually get that served down to the client?
View 2 Replies
Mar 29, 2010
I have a MS SQL view that I want to make available as a CSV download in my ASPNET Web Forms app. I am using Entity Framework for other views and tables in the project. What's the best way to enable this download?I could add a LinkButton whose click handler iterates over the view, writes its CSV form to the disk, and then serves that file. However, I'd prefer not to write to the disk if it can be avoided, and that involves iteration code that may be avoided with some other solution.
View 4 Replies
Mar 25, 2010
without using a database i wanted a file to point to the newest revision of a file. Someone suggested using a shortcut. Knowing i can rewrite file.ext to file.ext.lnk i thought it was a great idea. Then i tried it, my server (VS 2010rc) serves the shortcut rather then the file. Not what i wanted...How do i serve the file the shortcut is pointing to? NOTE: I am planing to use windows 2008 as my server so a solution should work on that as well. The OS i am running is windows 7.
View 4 Replies
Dec 17, 2010
I recently deployed a Windows 2008 R2 server with IIS.There was a problem with it and the hosting provider suggested a redployment of the image, which I relucantly did.Now all i getting back to wotking order except that no images/css are served (in fact all static content).Previously I set up my local machine to get images/css etc from static1.mydomain.co.uk which is a subdomain of mydomain.co.uk and this worked fine. I also had a test page on the live server with links to images on the static1 domain and all was good.Now neither the live site or my local site can access static content. I've also tried changing the live domain to itself rather than a subdomain (www.mydomain.co.uk)The pages serve correctly - just without any styling.I suspect its IIS - I've turned my firewall off as a test - the paths seem to be correct when viewed from the source code too.
View 1 Replies
Feb 18, 2010
How do you put views and content in a separate assembly that can be referenced from a MvcApplication?
View 3 Replies
Oct 25, 2010
I have a class library and was to add a resource file to it to support both English and Spanish. Any tips as how I can do this? The language will be dictated by the user visiting the site. Would like to have to only load each resource file once and cache or set in static variable and avoid any overheads.
View 2 Replies