426 users online

JSON errors in admin area (Solved...Fixed Topic Name to help searchers)

1 2 3 Next
Posted: 8 months ago Quote
Hello,

I recently upgraded a store to 2.0. All was well. Then I used the "change encryption key" feature in the admin area. Once I did this, things still seem to work for the most part, but certain parts of the admin area are broken. For example, going to "All Settings", and clicking the next and skip 10 navigation buttons causes a JavaScript popup "Error! The requested URL did not return JSON". If I check the event log, it's empty. I am also unable to disable any payment methods that are currently enabled. When I disable them and click the update button, I get the JSON error.

Has anyone else experienced this / know what causes this / etc.?

Thanks!
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
Encryption key has nothing to do with "All settings" page. Seems that some of the Telerik javascript files are not loaded
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Andrei Mazoulnitsyn,
LinkedIn - http://ru.linkedin.com/in/mazoulnitsyn

Twitter - http://twitter.com/#!/nopCommerce
Facebook community page - http://www.facebook.com/pages/NopCommerce/108282972527146
Google+ page - https://plus.google.com/100073150079669136049
Posted: 8 months ago Quote
Thanks, I will look into this.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
Ok, I have done some further analysis.

All Telerik dependencies were installed correctly.

However, in analyzing the web traffic, it is seen that we are not getting JSON returned.

On Local Machine (correct behavior)
--------------------------------------------
On the Telerik grid, I click the "next" button. The local server responds with a JSON content header, and the body of the response is the proper JSON data.

On Remote Server (incorrect behavior)
--------------------------------------------
On the Telerik grid, I click the "next" button. The remote server responds with a 301 redirect, with "Location" header redirecting to a different URL which seems to put the desired parameters into the querystring.

For example:
I am on this page:
/Admin/Setting/AllSettings/

I click the button

Browser sends this request using POST:
Host  mydomain.com
User-Agent  Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Accept  text/plain, */*; q=0.01
Accept-Language  en-us,en;q=0.5
Accept-Encoding  gzip, deflate
Accept-Charset  ISO-8859-1,utf-8;q=0.7,*;q=0.7
Content-Type  application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With  XMLHttpRequest
Referer  http://mydomain.com/Admin/Setting/AllSettings/
Content-Length  14
Cookie  mycookiestuff
Connection  keep-alive
Pragma  no-cache
Cache-Control  no-cache

page=2&size=15

Server responds with:
Content-Type  text/html; charset=UTF-8
Location  http://mydomain.com/Admin/Setting/AllSettings/?settings-grid-size=15
Server  Microsoft-IIS/7.5
X-Powered-By  ASP.NET
Date  Tue, 30 Aug 2011 16:25:34 GMT
Content-Length  209

My browser then makes the second request using XMLHTTP and gets a new web page returned as text/html. Because it is not JSON, the admin page doesn't know what to do and shows an error message.


On my local machine, when I do the same thing, the server responds correctly, and returns JSON, and the admin screen is fine.

Has anyone come across this strange error? This is a fresh install on my remote server. All required files are present, I have nop 2.0 in it's own standalone website, no monkey business with virtual directories or multiple IIS apps, it's installed exactly the way that has been advised on these forums (using prepare and deploy bat scripts, etc.)

Thank you!
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
Anyone have any ideas on this? I'm looking at a brick wall. Unfortunately, I can't really do anything in the admin area, unless it is a "page 1" action. Any setting that requires paging a grid will not function. It's really strange that the same code that works locally does not work on the server.

Thanks again
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
After doing more research on the Telerik forums, it seems that the Telerik grids will often give the error messages I'm seeing in a popup div element like "the requested url did not return json". However in all of these cases, the server returns a 500 code in the headers, along with the actual error message in the respone body.

In this case, again, I have installed nop 2.0 locally using the latest source code. I upgraded a 1.9 database, everything works great locally. I move everything up to my web host on a fresh website, with its own IP address. The main site is fine. The admin area is fine except for anything that uses grids.

Inspecting in Firebug reveals that on the remote server, my web browser makes the normal request to the server to go to page 2 of a grid. But then the application reacts differently than it does on my local machine. Instead of responding with HTTP 200 and actual JSON code, it is doing this:
* Responding with 301, and a location header to send to a different page
* My browser stays on the page I am on (b/c the 301 came from an AJAX request), but does make a second AJAX call to request the 301 target. In this case the page either exists, and I get a 200 back along with some HTML (which then makes the AJAX fail because the response was not the JSON it expected)
* OR, it ends up responding with a 302 to send me to an error page.

Here is a complete example of the request/response trail on the admin screen for products.

I go here: /Admin/Product/List/
I click on the "2" button to go to the next page. Here is what we see in Firebug:

Host: www.MyDomain.Com

###### REQUEST #1 (POST) ######

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Accept: text/plain, */*; q=0.01
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Content-Type: application/x-www-form-urlencoded; charset=UTF-8
X-Requested-With: XMLHttpRequest
Referer: http://www.MyDomain.Com/Admin/Product/List/
Content-Length: 75
Cookie: fc=fcVal=1752317306470848000; Nop.customer=18c4f7dc-2964-41db-9611-8a313bf672d3; NopCommerce.RecentlyViewedProducts=RecentlyViewedProductIds=462&RecentlyViewedProductIds=360&RecentlyViewedProductIds=355&RecentlyViewedProductIds=126; ASP.NET_SessionId=a3l5n4bgg2gaslujkoac35u2; NOPCOMMERCE.AUTH=2B016D2B404C4F2137560E6B8AAE86DF6897A5F5F6C767B987C9BFA55E281879D7A7BEC5B0DB93341C800DB99A8A1C5243B0F5B76A960DC6E9051C063C826EE822088F78D18EF1193208C644EFDBFD9888F6C0F13989A1B8D2BC8147D05C0DCAFBE0202642BCA2F3F50CF24B8DCB36641EFA77E526A1534D70B928502F2996E99CB815B30F5B28B2FBFA123C74968B8D2C86DE721E69858694B5DD343BFA4436
DNT: 1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache

page=2&size=15&SearchProductName=&SearchCategoryId=0&SearchManufacturerId=2

###### RESPONSE #1 ######
Content-Type: text/html; charset=UTF-8
Location: http://www.MyDomain.Com/Admin/Product/ProductList/?products-grid-size=15
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 31 Aug 2011 13:37:40 GMT
Content-Length: 209

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Resource not found</title>
</head>
<body>
    <h1>
        We're sorry, there is no Web page matching your request.</h1>
    <p>
        It's possible you typed the address incorrectly, or that the page no longer exists.
        In this case, we profusely apologize for the <b>inconvenience</b> and for any damage
        this may cause.
    </p>
</body>
</html>


###### REQUEST #2 (GET) ######
Host: www.MyDomain.Com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/
*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Referer: http://www.MyDomain.Com/Admin/Product/List/
Cookie: fc=fcVal=1752317306470848000; Nop.customer=18c4f7dc-2964-41db-9611-8a313bf672d3; NopCommerce.RecentlyViewedProducts=RecentlyViewedProductIds=462&RecentlyViewedProductIds=360&RecentlyViewedProductIds=355&RecentlyViewedProductIds=126; ASP.NET_SessionId=a3l5n4bgg2gaslujkoac35u2; NOPCOMMERCE.AUTH=2B016D2B404C4F2137560E6B8AAE86DF6897A5F5F6C767B987C9BFA55E281879D7A7BEC5B0DB93341C800DB99A8A1C5243B0F5B76A960DC6E9051C063C826EE822088F78D18EF1193208C644EFDBFD9888F6C0F13989A1B8D2BC8147D05C0DCAFBE0202642BCA2F3F50CF24B8DCB36641EFA77E526A1534D70B928502F2996E99CB815B30F5B28B2FBFA123C74968B8D2C86DE721E69858694B5DD343BFA4436
DNT: 1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache


###### RESPONSE #2 ######
Cache-Control: private
Content-Type: text/html; charset=utf-8
Location: /filenotfound.htm?aspxerrorpath=/Admin/Product/ProductList/
Server: Microsoft-IIS/7.5
X-AspNetMvc-Version: 3.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Date: Wed, 31 Aug 2011 13:37:40 GMT
Content-Length: 176

Reload the page to get source for: http://www.MyDomain.Com/Admin/Product/ProductList/?products-grid-size=15

###### REQUEST #3 ######
Host: www.MyDomain.Com
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:6.0) Gecko/20100101 Firefox/6.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Referer: http://www.MyDomain.Com/Admin/Product/List/
Cookie: fc=fcVal=1752317306470848000; Nop.customer=18c4f7dc-2964-41db-9611-8a313bf672d3; NopCommerce.RecentlyViewedProducts=RecentlyViewedProductIds=462&RecentlyViewedProductIds=360&RecentlyViewedProductIds=355&RecentlyViewedProductIds=126; ASP.NET_SessionId=a3l5n4bgg2gaslujkoac35u2; NOPCOMMERCE.AUTH=2B016D2B404C4F2137560E6B8AAE86DF6897A5F5F6C767B987C9BFA55E281879D7A7BEC5B0DB93341C800DB99A8A1C5243B0F5B76A960DC6E9051C063C826EE822088F78D18EF1193208C644EFDBFD9888F6C0F13989A1B8D2BC8147D05C0DCAFBE0202642BCA2F3F50CF24B8DCB36641EFA77E526A1534D70B928502F2996E99CB815B30F5B28B2FBFA123C74968B8D2C86DE721E69858694B5DD343BFA4436
DNT: 1
Connection: keep-alive
Pragma: no-cache
Cache-Control: no-cache


###### RESPONSE #3 ######
Content-Type: text/html
Last-Modified: Fri, 26 Aug 2011 13:35:15 GMT
Accept-Ranges: bytes
Etag: "d26a44fdf463cc1:0"
Server: Microsoft-IIS/7.5
Set-Cookie: Nop.customer=18c4f7dc-2964-41db-9611-8a313bf672d3; expires=Thu, 30-Aug-2012 13:37:40 GMT; path=/
X-Powered-By: ASP.NET
Date: Wed, 31 Aug 2011 13:37:40 GMT
Content-Length: 562

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Resource not found</title>
</head>
<body>
    <h1>
        We're sorry, there is no Web page matching your request.</h1>
    <p>
        It's possible you typed the address incorrectly, or that the page no longer exists.
        In this case, we profusely apologize for the <b>inconvenience</b> and for any damage
        this may cause.
    </p>
</body>
</html>
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
I did one final test. I went on the remote server and scripted the entire database. I then ran the script locally on a brand new database. I pointed the source code to the new database, and the admin area works.

I replaced all of the website code on the remove server with this local copy, and the issue exists still.

So if both the website and database work locally, and have been eliminated from the variables on the remote server, perhaps it is a server configuration issue? Does anyone know if IIS needs certain settings for the Telerik AJAX posting to work? I tried adding POST to the list of verbs in the web.config files, but didn't see any change in behavior.

Thanks for any help that can be provided.
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 8 months ago Quote
Ok, I finally figured this one out.

It was all due to a stupid built-in rule in the IIS 7 URL Rewrite module.

this one here:

<rule name="AddTrailingSlashRule1" stopProcessing="true">
                    <match url="(.*[^/])$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                    </conditions>
                    <action type="Redirect" url="{R:1}/" />
                </rule>


was causing this AJAX call:
POST /Admin/Product/ProductList?products-grid-size=15

to be 301 re-directed to:
/Admin/Product/ProductList/?products-grid-size=15

Boy, am I glad I have that one figured out!
This post/answer is useful
2
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
Posted: 6 months ago Quote
Thanks for posting this. You have saved me an unimaginable amount of time and sanity.

Much appreciated
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
Posted: 6 months ago Quote
You're most welcome. That's what these forums are all about...documenting our problems AND our solutions!

Cheers
This post/answer is useful
0
This post/answer is not useful

Please login or register
to vote for this post.

(click on this box to dismiss)
E. Jackson
1 2 3 Next