Page Not Found Switching Currency

5 months ago
Hello

I have added some currencies to the home page but when switching between them it reports a page not found error. Once I refresh the content the currency is displayed correctly. Here is a wireshark snippet.

GET /nopcommerce/changecurrency/6?returnUrl=%2Fnopcommerce HTTP/1.1
Host: 192.168.1.10
Cookie: .Nop.Antiforgery=CfDJ8NN3YkfcegVAs7ek3hSn4nUyuhvfyVF2tUoKTanbRS1wpz5ZawPFA6ZZY4JNRqcFK06Ph9EjDcD3VGxWXA9b2gEbHFFTFps06AWl7Vk_R5z7OOmdPv3xNR2DVVdRzKN0uhN52pD1MW8AXpLLGKo23nQ; .Nop.Culture=c%3Den-US%7Cuic%3Den-US; .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; .Nop.RecentlyViewedProducts=43
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1
Referer: http://192.168.1.10/nopcommerce
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate

HTTP/1.1 302 Found
Transfer-Encoding: chunked
Content-Language: en-US
Location: /nopcommerce/nopcommerce
Server: Microsoft-IIS/10.0
X-MiniProfiler-Ids: ["175da155-f953-4cea-ba1a-f4e5bb761228"]
Set-Cookie: .Nop.Customer=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/
Set-Cookie: .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; expires=Fri, 15 Nov 2024 16:15:17 GMT; path=/; httponly
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'self'; connect-src *; font-src * data:; frame-src *; img-src * data:; media-src *; object-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline';
Referrer-Policy: same-origin
Permissions-Policy: accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=*, usb=()
Date: Thu, 16 Nov 2023 16:15:17 GMT

GET /nopcommerce/nopcommerce HTTP/1.1
Host: 192.168.1.10
Cookie: .Nop.Antiforgery=CfDJ8NN3YkfcegVAs7ek3hSn4nUyuhvfyVF2tUoKTanbRS1wpz5ZawPFA6ZZY4JNRqcFK06Ph9EjDcD3VGxWXA9b2gEbHFFTFps06AWl7Vk_R5z7OOmdPv3xNR2DVVdRzKN0uhN52pD1MW8AXpLLGKo23nQ; .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; .Nop.Culture=c%3Den-US%7Cuic%3Den-US; .Nop.RecentlyViewedProducts=43
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1
Referer: http://192.168.1.10/nopcommerce
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate

HTTP/1.1 302 Found
Transfer-Encoding: chunked
Content-Language: en-US
Location: /nopcommerce/page-not-found
Server: Microsoft-IIS/10.0
X-MiniProfiler-Ids: ["45f22d18-999a-4f5c-b645-bf87d86d259d"]
Set-Cookie: .Nop.Customer=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/
Set-Cookie: .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; expires=Fri, 15 Nov 2024 16:15:17 GMT; path=/; httponly
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'self'; connect-src *; font-src * data:; frame-src *; img-src * data:; media-src *; object-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline';
Referrer-Policy: same-origin
Permissions-Policy: accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=*, usb=()
Date: Thu, 16 Nov 2023 16:15:17 GMT

GET /nopcommerce/page-not-found HTTP/1.1
Host: 192.168.1.10
Cookie: .Nop.Antiforgery=CfDJ8NN3YkfcegVAs7ek3hSn4nUyuhvfyVF2tUoKTanbRS1wpz5ZawPFA6ZZY4JNRqcFK06Ph9EjDcD3VGxWXA9b2gEbHFFTFps06AWl7Vk_R5z7OOmdPv3xNR2DVVdRzKN0uhN52pD1MW8AXpLLGKo23nQ; .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; .Nop.Culture=c%3Den-US%7Cuic%3Den-US; .Nop.RecentlyViewedProducts=43
Connection: keep-alive
Upgrade-Insecure-Requests: 1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.2 Mobile/15E148 Safari/604.1
Referer: http://192.168.1.10/nopcommerce
Accept-Language: en-GB,en;q=0.9
Accept-Encoding: gzip, deflate

HTTP/1.1 404 Not Found
Cache-Control: no-cache, no-store
Pragma: no-cache
Transfer-Encoding: chunked
Content-Type: text/html
Content-Encoding: gzip
Content-Language: en-US
Vary: Accept-Encoding
Server: Microsoft-IIS/10.0
X-MiniProfiler-Ids: ["b13615c0-7b2d-42cd-9dc9-97d82b1a480c"]
Set-Cookie: .Nop.Customer=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/
Set-Cookie: .Nop.Customer=34144170-fd17-475e-ab1b-149eca87bc1f; expires=Fri, 15 Nov 2024 16:15:17 GMT; path=/; httponly
Set-Cookie: .Nop.Culture=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/
Set-Cookie: .Nop.Culture=c%3Den-US%7Cuic%3Den-US; expires=Sat, 16 Nov 2024 16:15:17 GMT; path=/
Set-Cookie: .Nop.TempData=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/nopcommerce; samesite=lax; httponly
X-XSS-Protection: 1; mode=block
X-Frame-Options: SAMEORIGIN
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=31536000; includeSubDomains
Content-Security-Policy: default-src 'self'; connect-src *; font-src * data:; frame-src *; img-src * data:; media-src *; object-src *; script-src * 'unsafe-inline' 'unsafe-eval'; style-src * 'unsafe-inline';
Referrer-Policy: same-origin
Permissions-Policy: accelerometer=(), camera=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), payment=*, usb=()
Date: Thu, 16 Nov 2023 16:15:17 GM
5 months ago
Just an update.

It would appear that when changing currencies the url becomes /nopcommerce/nopcommerce/ as opposed to just /nopcommerce/. It is also happening on a brand new installation with only the single additional currency published.
5 months ago
What nopCommerce version? Something similar has been fixed recently in the develop branch, see details here.
5 months ago
Hi

The version is 4.60.5 and it is hosted under IIS in a virtual directory.

Is there a fix I can implement?

Graham
5 months ago
You can reproduce the changes from this commit, then rebuild Nop.Web.Framework project, and replace Nop.Web.Framework.dll on your server.
5 months ago
Problem solved.

I had to remove the var in this line as it was already declared further up in the block of code.

var uri = new Uri(uriStr, UriKind.Absolute);

Thanks!