I have been working on a web application that has a c# page that takes in some query parameters and generates the output as javascript.
For example: I have a page called http://mysite.com/test1.aspx. I use this page to process an xml file and pick up only the feed items specified in the query string and output javascript. The javascript just has html content with the following code below:
This basically puts the feeds on another site, and any third party site for all the browsers except Chrome, which fails to display the html content and gives me an error saying : Failed to load resource at the "http://mysite.com/test1.aspx?feeds=2&color=222222"
page. All the browsers work fine except for Chrome. This works fine with Safari which technically means it should also work in Chrome. But, I cannot seem to get around the problem and find a solution for this. Am I am following the incorrect approach, are
there any other alternatives solutions that I can use. Will it be useful if I use a web service and process the data as JSON? Could you if please let me know if I am doing something wrong with my current approach and if I can use a different approach.
Invoke the developer tools (By pressing shorcut key F12) in Google chrome and go to the Network tab. There you can see what are the resources loaded and failed to load.
Thank you for your reply. I have already looked in the console. It only says: Failed to load resource http://mysite.com/test1.aspx?feeds=2&color=222222.
Thank you for your help. I am able to fix the problem, by using a http handler (.js) that outputs javascript, that can be included on any page with domain restrictions.
smksu
Member
69 Points
34 Posts
Dynamic Javascript output from c#
Feb 22, 2012 07:25 PM|LINK
Hello All,
I have been working on a web application that has a c# page that takes in some query parameters and generates the output as javascript.
For example: I have a page called http://mysite.com/test1.aspx. I use this page to process an xml file and pick up only the feed items specified in the query string and output javascript. The javascript just has html content with the following code below:
The c# page does not create a javascript file, but it just outputs javascript when the page is processed.
I inculde this file in another site as below:
This basically puts the feeds on another site, and any third party site for all the browsers except Chrome, which fails to display the html content and gives me an error saying : Failed to load resource at the "http://mysite.com/test1.aspx?feeds=2&color=222222" page. All the browsers work fine except for Chrome. This works fine with Safari which technically means it should also work in Chrome. But, I cannot seem to get around the problem and find a solution for this. Am I am following the incorrect approach, are there any other alternatives solutions that I can use. Will it be useful if I use a web service and process the data as JSON? Could you if please let me know if I am doing something wrong with my current approach and if I can use a different approach.
Thank you for all your time.
sumansunkara
Member
71 Points
15 Posts
Re: Dynamic Javascript output from c#
Feb 22, 2012 08:38 PM|LINK
That a weird error! Anyways, I bet processing the data using object notation should work fine in any browser that has js enabled.
Ruchira
All-Star
42936 Points
7023 Posts
MVP
Re: Dynamic Javascript output from c#
Feb 23, 2012 07:43 AM|LINK
Hi,
Invoke the developer tools (By pressing shorcut key F12) in Google chrome and go to the Network tab. There you can see what are the resources loaded and failed to load.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.smksu
Member
69 Points
34 Posts
Re: Dynamic Javascript output from c#
Feb 23, 2012 06:34 PM|LINK
Hi Ruchria,
Thank you for your reply. I have already looked in the console. It only says: Failed to load resource http://mysite.com/test1.aspx?feeds=2&color=222222.
Thank you.
Ruchira
All-Star
42936 Points
7023 Posts
MVP
Re: Dynamic Javascript output from c#
Feb 24, 2012 05:28 AM|LINK
Hello,
Not the consolde. Select the Network tab and see.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.smksu
Member
69 Points
34 Posts
Re: Dynamic Javascript output from c#
Feb 25, 2012 11:15 PM|LINK
Hello Ruchria,
When I look into the Network tab it says GET failed.
Thank you!
skcookie
Member
534 Points
138 Posts
Re: Dynamic Javascript output from c#
Feb 26, 2012 12:30 AM|LINK
Patrick P.
Microsoft Certified Professional
Remember to mark as answer where appropriate!
smksu
Member
69 Points
34 Posts
Re: Dynamic Javascript output from c#
Feb 29, 2012 01:05 AM|LINK
Hello All,
I think I have to find a another solution something like http handlers or JSON. Thank you.
smksu
Member
69 Points
34 Posts
Re: Dynamic Javascript output from c#
Mar 01, 2012 11:40 PM|LINK
Hello All,
Thank you for your help. I am able to fix the problem, by using a http handler (.js) that outputs javascript, that can be included on any page with domain restrictions.
Thank you.