When I update my stylesheet in Windows 7, it breaks - Front- & Back-End Development - Front- & Back-End Development - Progress Community
 Front- & Back-End Development

When I update my stylesheet in Windows 7, it breaks

  • When I update my stylesheet in Windows 7, it breaks
  • When I update stylesheets for the Sitefinity project I'm working on, the stylesheets break when using my laptop which uses Windows 7 64-bit. After trying on my desktop using Windows Vista, I realized the stylesheet extensions had changed (like styles.css.txt), which was breaking them. After re-saving on my desktop, I had no problem editing stylesheets. But my laptop saves them with the wrong extension. I need to be able to work while I travel, so it's important to get it working on my laptop..

    Has anyone had this problem, and does anyone have an idea what the cause is? The only thing I could think of is my version of Windows not working with Sitefinity. The site also uses Icinity for ecommerce, I don't know if that's somehow related.
  • This is indeed weird

    Can you share your editing environment? ....Visual Studio 2010?...any plugins\extensions installed?
  • I've tried editing 2 different ways, and I've tried in 2 different Sitefinity versions. Both ways do not work on my windows 7 laptop, but do work on my windows vista desktop. Here's more details on what i've tried:

    - on laptop, using remote desktop to connect to development server, I open stylesheet in Notepad. If I delete any style, and re-save the file, the stylesheet breaks.
    - on laptop, i download the stylesheet through Sitefinity, open the file in Dreamweaver, delete any style, re-upload the css file through Sitefinity, and again, it breaks.

    I'm POSITIVE I'm not making a CSS error by the way, i've tested over and over again, and simply opening the same stylesheet on my desktop with Vista, without making any changes, and re-saving, fixes the problem. It's very strange, and very frustrating.
  • Well the good news is that it's certainly nothing to do with sitefinity, but the bad news is why this would happen on that PC :)

    I say it's not sitefinity because it's not physically doing anything aside from living on your filesystem.  The external editing tools are what are changing the files IN the sitefinity directory (which for all intents and purposes is just a "dumb" folder with some DLLs and assets).

      Initially I would think that if the file is marked as readonly, the notepad would prompt to enter a name to save it as, and perhaps without quotes around the filename, it'll append .txt to it?

  • It can't be something with Notepad, because the same happens with Dreamweaver. And If I access remote desktop using my Vista PC, and use Notepad on remote desktop, it works fine. But If I access remote desktop on my Windows 7 laptop and again use Notepad on remote desktop, it breaks. Same with Dreamweaver. And it gets even weirder.

    - If I delete any style in the stylesheet, the stylesheet breaks
    - If I bring back the deleted style, and re-save, it works again
    - sometimes if I edit a style, or add a style, it works. sometimes not---I haven't figured out the pattern there.

    So sometimes it saves properly, sometimes not, using the Windows 7 computer.

    I've edited many styesheets for many different CMSs and other situations on both computers. I've never faced a problem like this. So I can only think that it must have something to do with the CMS, either Sitefinity, or Iciniti (the ecommerce system in use with Sitefinity). But I don't have enough knowledge about anything beyond HTML/CSS to know what could possibly be causing this. i have a support ticket open with Sitefinity, and have also contacted Iciniti. Iciniti offered no help, and told me it's a Sitefinity issue, and I have yet to hear back from Sitefinity.

    Thanks for trying to help me with this. Any other ideas you have about what might be the cause are greatly appreciated.
  • Dear Jenn

    Sorry this is a very dumb idea. But on some computers you might have when saving the file the settings on the bottom default to .txt and not anyfile

    Make sure on this computer you are showing your extensions for know files. Your file explorer should show

    mydocument.doc instead of mydocument

    I don't know what OS you are running, and dont know how it is called in english (have DE OS). But most likely you will find this somewhere underer folder options - advanced  and uncheck the hide extensions on known document types.

    Windows 7 in file explorer - Organize - Folder and Search Options - View tab - Hide extensions from know file types (free translation)
    This should be done on any computer anyhow.

    And now if you open a css (try it with editor)  make sure that when saving that you have the right selection on the bottom.

    Sorry for giving such bad, simple maybe not working advice but that's the only starting point I can think off.

    Kind regards

  • Hey Jenn

    In support of dumb ideas, I think it's best to first really test what happens on your laptop before you upload through Sitefinity. Markus was right, showing file extensions is a good idea because if you open a .css file in Notepad and use 'save' it gets overwritten, if you use 'save as' the .txt extension gets added. Edit and Create some new files, copy them onto an USB stick and go take a look at them on your Vista machine.

    Also, on a sidenote, since we're talking about Notepad, you might want to give Notepad++ a try. It's the same no nonsense plain text editor, but it has syntax high-lighting for stuff like css/asp/xml and it doesn't do the flacky extension overwrite.

    If you're sure about the Windows 7 machine saving the files with the correct extension, you might want to check out localization. I'm not blaming that or have a reason to believe that's the culprit, but stranger things have happened when you're not on English as a default language. 

    And as a last blond suggestion, try uploading them through Dreamweavers FTP or an external program and see if the extensions still change.

  • Hi guys,

    Notebook isn't the only program saving files incorrectly. Dreamweaver is doing it as well. When in notepad, I made sure while saving that it was not set to save as .txt. And again, the problem is also in Dreamweaver. This has never happened in any other project I've worked on, only this Sitefinity project. And only on my Windows 7 laptop. My laptop works fine for everything else, I always save files in Dreamweaver, I've never seen this problem.

    English is the default language.

    I don't have FTP access to the project, but I have used Sitefinity to download and re-upload the CSS file, as well as using remote desktop.

    A strange thing too, it doesn't always save wrong. It seems that once I have deleted a style from the stylesheet, it starts acting bonkers. But say after deleting a style and breaking the stylesheet, if I just add the style back in, and re-save, it magically works again.

    Sitefinity support thinks it's related to cache. I don't understand how this could completely break the stylesheet though, and why it would only happen on one computer, and not the other. Here's the message I got from support:

    I am also working on Windows 7 64 and have never experienced the issues before.
    I suppose the problem comes from caching. By default Sitefinity has enabled caching for all content and additionally the browser may have cached the previous css.
    Can you try when uploading new stylesheet to: restart web.config/build the project/whait some time untill the new style document is addressed/edit the page where the style should be applied and publish it/clear browser cache.
    Sometimes when adding something new to Sitefinity which is web application project it is not instantly recognized. This is one of the differences from a website project (Excuse me if you have converted your SF project to be website, I was not aware.)

    It doesnt make sense to me.. it's not that my stylesheet isn't updating immediately; it's completely breaking. if it makes sense to any of you, and you'd like to offer some explanation, it would be a big help!
  • by the way, I'm not positive that the extension is changing. weeks ago when i started the project, that was the conclusion I came to. But now, weeks later, I haven't seen any indication of the extension changing. Checked files on both systems, everything says its a cascading stylesheet, .css. Completely confused...
  • Ok... So just in case it is changing, here's another shot-in-the-dark probable cause... 

    The RadFileExplorer/RadUpload uses integrated validation and a custom validator to verify files and extensions.

    The hidden file extension causes the Integrated validator to mark it as an invalid file and someone on the Telerik/Sitefinity coded it to just add the .txt extension when it doesn't know how to handle a file.

    After the integrated validation there is a custom validator called, either client side or server side (don't know what Telerik implemented) 

    They use client side validation, and the combination of hidden file extensions and .css automatically opening in Notepad throws the Uploader off and makes it believe it's a text file and thus adds that as a valid file extension to the file on the server. 


    They use server side validation and on the hosted webserver the mime-type for css is set incorrectly to plain text and that, in combination with the hidden file extension, causes the error.

    As said, shot in the dark and I could be completely off :) But to be safe, turn file extensions on for known file-types on the laptop.

  • Ok, I've enabled extensions as you and Markus suggested. Unfortunately the site is still going crazy.

    Tech support said it's a cache issue, and there are a couple other problems I've had with Sitefinity that I've been told are related to cache. So I'm starting to think there's something I'm not understanding about cache.

    How the heck can cache make a stylesheet completely break, freeze a website, and only on my laptops, but not on desktops running different windows versions?

    When making CSS changes, I always use f5 to refresh the CSS, but beyond that, I don't know much about cache. And I don't completely understand the suggestion from support:


    Can you try when uploading new stylesheet to: restart web.config/build the project/whait some time untill the new style document is addressed/edit the page where the style should be applied and publish it/clear browser cache.
    Sometimes when adding something new to Sitefinity which is web application project it is not instantly recognized. This is one of the differences from a website project (Excuse me if you have converted your SF project to be website, I was not aware.)

    restart web.config...what?  I've tried opening a page and pubslishing, because I think this clears Sitefinity's cache, but this doesn't seem to be working either. Am I missing something?

  • Hey Jenn,

    I think we're all missing something, not just you...

    Sitefinity uses a caching system, your webserver uses a caching system and your browser uses a caching system. When you add/change a style rule or add a new theme or a widget to the toolbox all these caching systems basically need to flush and rebuild their cache. 

    Sometimes, it can cause a temp quirk, just like there's a difference between hitting enter in the adress bar and clicking the refresh button on your browser. Maybe your workstation is set up to always fetch from server and your laptop has some long caching options enabled. Maybe you use the laptop thru a RDC and it has some caching policies installed on the dial in server... 

    What they mean is, if you open the web.config and add a space somewhere, save it and then upload it again to the server, that will trigger a rebuild on the server and sequentially Sitefinity. That's the best way to guarantee that at least on the server side everything is new and reflects the latest version.

    Clearing the browser's cache is something you have to do, but hitting ctrl/shift F5 a few times usually triggers it. If you really got serious issues with freezing and breaking the site, you're going to have to give us some more clues... 

  • Jochem thanks so much for helping me with this.

    I have no idea what sort of clues to give. I haven't seen anything like this with any other website I've worked on, so I don't even know where to start. In one project using Sitefinity 4.2, editing stylesheets using my laptop is literally crashing the site. It stops loading altogether. In another project using Sitefinity 4.1, editing stylesheets breaks the stylesheet, without breaking the rest of the site. This happens on both laptops I use, which are both Toshiba, Windows 7 64, in other words, very similar laptops. This does not happen on the other 2 computers I've tried, neither of which use Windows 7 64. It sounds like Windows is not the issue though, at least according to tech support. I'm completely clueless.

    I delete a style from my stylesheet, hit save, upload, site breaks.

    I add the style back in, hit save, upload, the site works again.
    Or, I open the stylesheet on a different computer, hit save, upload, and it works again.

    It's nonsense, I'm lost and completely frustrated with this system.

  • Dear Jenn

    I think the best think would be if you could make a screencaset www.jing.com is a free tool.

    So we actually see what you are doing and what you refer to when you say the site breakts. (front-end) back-end.

    Could you also try to attach the two CSS files one working and one once its broken.

    Can you link us to a site online where its not working so we can see what it looks like.

    Without these steps I think we will be like hunters shooting in the dark blindfolded and turned around a couple of times. If we will really hit the issue that would be a lucky shot.

    Regards Markus