Nopcommerce long url - c#

I'm using an old nopcommerce 1.90
When i'm trying to access admin panel it generates very long url in all admin pages...
For example: www.mynopcommercestore.com/(F(rdJxygsKRvgH2-aXCIZR0C3pi39UpnKohhHrrbT1ATunvMt4FfV88V0ebEUgb_XXiUkww8KnBeaG66D6wjA82Kl4UsbeUHmBQN2Pp0fn08yISQ6wyjuFhPZFC-5AiXJuTPvTdDEgf7wCucjqc6hPhK_d-GuuNrpSQklM7tjy4kybCjFA4i15IEGfu8tNUWOV9lCqJBEJuE0CXV96XVhHY2n-ykKlQUxLkoVC49txwzls2iMU0))/administration/ProductDetails.aspx?ProductId=563
What is this "strange" string? cookieless? (i have already set it to false)
I'm getting an error when i'm trying to upload an image in ckeditor
(The server didn't reply with a proper XML data. Please check your configuration.)
XML request error: Request-Uri Too Long (I have also set in web.config maxUrlLength="2097151")
But when i remove this "strange" string from url it uploads well.
Could someone help? How to avoid this long url in system?
Kind Regards

You should disable "Cookieless Sessions" in web.config file. Please find more info here

Related

How to fix issue when entering www.sitename.com/ROBOTS.TXT in URL only refreshes the page

I have a site that's about to be taken down in month's time. What I need to do is place a robots.txt to prevent the search engine from indexing it any longer. However, after I placed the file on the root of the solution in the web server, and tried to check if I can access it by typing www.sitename.com/robots.txt, it just refreshes the screen or perhaps just returns to the home page. My application is running in MVC 3.
Things I've already tried:
Added modules runAllManagedModulesForAllRequests="true" in web.config
Used Dynamic Robots.Txt using IHttpHandler and Controller/Action approach (based on this link robots.txt file for different domains of same site)
Played around with MIME Types (removed .txt and back)
I am expecting to see the contents of the robots.txt file same as when I access a css file or js file just by appending the file name in the URL.

ASP.Net Core Returning 404 when image url spaces encoded as +

I have URLs stored in a database where the spaces are encoded as +.
When the browser requests these urls the web server returns a 404 response.
These URLs are all for static images stored on the web server in the wwwroot folder.
If I manually change the + for %20 then the image is returned correctly.
Is this a deliberate change in ASP.Net Core or is this a bug?
If it's deliberate, then it's going to be very painful for me going through the database and re-encoding all the URLs, many of which are embedded in HTML snippets (I know storing HTML in the DB or having spaces in image files aren't a good idea but it was done long before I joined the company and that's the state we're already in).
I'm using ASP.Net 2.1, running on .Net Framework.
It's running through IIS Express at the moment (during development) but will be deployed with full IIS.
I have seen this other question but it's specifically to do with API calls and the answer doesn't seem to be applicable to my question as there are no routes to change as I'm requesting static image files.
Edit: Extra detail
The html is output using #Html.Raw(html)
The resulting html output to the browser is of the form
<img src="/BorderThemes/grey+4px+rounded+corners_TL.png" />
The Html was generated on the server and then stored in the DB so we can be confident it's safe to output to the browser and, no, I have no idea why anyone would do that rather than building the HTML when it's needed but it was before my time and it's the situation I'm already in.
Update:
I've looked deeper into this and if I enter http://localhost:8000/BorderThemes/grey+4px+rounded+corners_TL.png into my web browser I get a page from IIS saying Http Error 404.11 saying that my URL is double encoded and linking to here for more information. This does include instructions on how to allow double-encoding but with warnings that it can have security consequences.
If I enter the url http://localhost:8000/BorderThemes/grey%204px%20rounded%20corners_TL.png I get an image back.
I was having issues with paths / html stored in the DB but after experimenting, it appears that System.Net.WebUtility.UrlEncode encodes spaces as +. For example WebUtility.UrlEncode("foo bar.png") returns foo+bar.png, which is rejected as double-encoded by IIS.
Am I missing something or is Microsoft's function for encoding URLs encoding the URLs in a way that Microsoft's web server rejects?
If you want %20 instead of + tryusing EscapeDataString to encode URI :
Uri.EscapeDataString(someString);
Refer https://stackoverflow.com/a/50682381/704008
But you have already generated url & can'e do anything now so try using HtmlDecode like
System.Net.WebUtility.HtmlDecode.HtmlDecode(html);
I am not sure it best to use with Raw or some method exists like decode in #Html but try using :
#Html.Raw(System.Net.WebUtility.HtmlDecode(html))
Refer:
https://learn.microsoft.com/en-us/dotnet/api/system.net.webutility?view=netstandard-2.0
https://learn.microsoft.com/en-us/dotnet/api/system.net.webutility.urldecode?view=netstandard-2.0#System_Net_WebUtility_UrlDecode_System_String_

nancyfx unreachable exist file

I use nancyfx.
I have published a folder with files.
I start the server and observe the following situation:
If there is a file '1.html' in the published folder, then I get it through the browser. If I delete this file from the disk, I get an error 404 (this is correct). If I add this file to disk again, or I change its contents, I normally get it in the browser.
If after starting the server I try to access from the browser to a nonexistent file '2.html', I get an error 404 (This is correct). However, if after that I create the file '2.html' on the disk, I still get a 404 error. It helps only restart the server.
I got the impression that nancyfx at the first access to the requested files forms some kind of cache, which subsequently does not allow me to get the files added after they were unsuccessfully requested.
Help please with the decision of the given problem. Thank you in advance.
Nancy uses a convention based approach for figuring out what static content it is able to serve at runtime. you can check the Documentation here

PDF does not reload on directory browsing

Hi guys this is my follow up question and I think this is the real issue here. Click Here
Whenever I access the file using the directory browsing (eg. http://localhost/temp/1.pdf) it always render the old or previous PDF file even if I change the entire file with the same file name, example I have 1.pdf with some content then I delete this file on the directory then replace with new and different content and rename it to 1.pdf then when I access it using browser it always render the previous value not the new one that I replace. This only happens on IE and Opera browser. Please need help this is a production issue.
Edit:
I found something very strange, example i have this url for the location of the pdf file (eg. http://localhost/website/tempfolder/1.pdf) the first pdf that I generated will show then some part in my code I change the casing of some letter example 't', I change it to 'T' then the newly pdf shows but when I revert back to the old case expecting that it will show the new pdf but sad to say the first PDF file shows.
Your browser is probably caching the PDF files.
For IE, you can do a CTRL F5 to force it to reload from web server.
Or put a random query string in your URL
e.g. /temp/1.pdf?v=1, /temp/1.pdf?v=2
Assuming you server is IIS, permanent solution is to configure HTTP response headers.
Go to IIS manager
Navigate to your folder
Click "HTTP Response Headers" in Features View
Right-button click/select "Set Common Headers"
Check "Expire Web Content" and select "Immediately".

POST data to a Flex/Flash (mxml) application

I have Flex application requiring to filter users depending on there database groups. Depending on which group they are, the're is a config.xml file that is use to populate the swf.
Here is how I figure how to do this :
1. The client comes to a .aspx page with a form requiring a username and a password.
2. On the server side I confirm the user credential
3. Once the username/password is valid I redirect to the mxml file with the config.xml file in the html headers (post).
My problem comes when I need to get the post data from the http request. Let's say I have this code :
<mx:Application initialize="init()">
<mx:Script>
<![CDATA[
private function init():void
{
// get the post data here
}
/* More code here */
]]>
</mx:Script>
</mx:Application>
How do I get the post data on the init() function.
Thank you.
For those that would be interested, I've found some ressources on the Adobe Flex 3 Ressource center.
Basically there is no current way to pass data with the POST method. You can either add the parameters at the end of you swf url (GET method) as shown here : http://livedocs.adobe.com/flex/3/html/help.html?content=deep_linking_5.html#245869
The other way is to embed them in the page with the flashVars method shown here : http://livedocs.adobe.com/flex/3/html/help.html?content=passingarguments_3.html#229997
If you still wonder, how I'll manage to do this if you run to in the same situation. Here is my idea (feel free to share if you have different vision) :
1.User logs in login.aspx
2.Depending on the credentials of the users the server side code modify the index.html file to embed the correct xml file in the flash object.
3.With the FlashVars method, I get back the xml file path and job done!
If you ever run in a similar situation and need help contact me.
I don't think it's possible to get the POST data, but others might have a way. An alternative solution would be:
User logs in: login.aspx
User directed to Flash content: content.html embedding content.swf
Flash requests config.xml from server: content.swf makes HTTP request for config.xml.aspx
Server provides user's configuration in config.xml.aspx
In your init() function, you'd make the URLLoader request to get the configuration, and you'd do the configuration in the Event.COMPLETE handler.
Another possibility is to use HTTP cookies--not handled natively by Flash, but you can get to them via Javascript--see this CookieUtil class.

Categories