Umbraco says it's saved changes to templates but the changes are lost - umbraco

Each time I make a change to an Umbraco template and press Save, I get the confirmation popup saying:
Template saved
Template saved without any errors!
However, when I return to that template (click on another template and then back again), the changes have been lost.
I've ensured that the user account running my IIS application pool has Full Control over the \Views folder containing the .cshtml files (i.e. the Umbraco templates).
Strangely this just started happening, after it had been letting me make template changes with no problems. I can manually edit the .cshtml files on disk, but this seems ridiculous.
Any ideas?

A couple of things:
1) Have you checked that the following Windows accounts have full permissions for all folders "IUSR", "IIS_IUSRS", "NETWORK SERVICE" ?
2) Probably not but I have had problems in the past with caching. Have you disabled (set from True to False) caching properties in /config/umbracoSettings.config ? This should always be done during development.

OK, I'll provide an answer for others' future reference (although the reasons are unclear to me). It appears the change I was making to my Template must've been deemed invalid by Umbraco - when I strip the template text down to just a single, empty div and save it, the change is persisted successfully.
The confusing thing is that Umbraco provides no feedback as to why it's not saving - in fact it tells you that it HAS saved successfully.
Bizarre and confusing.

Just been editing my templates and got this problem. Fixed it by doing the following:
sign out of umbraco
clear your browsing data
sign back into umbraco
always be sure to copy and paste your code somewhere to keep it safe, and it can be easily pasted back in. Seems like a bug to me... but it saved after I did that.
(Using Umbraco 7)

Related

VS 2012 publishing a webside 2 big problems

I am new to coding and everytime I ask a question I feel like stupid because I mostly am unfamiliar with most known things in this "industry" so I will sum up the whole situation fastly.
I learned how to code html css and js, I learned how to use VS 2012 asp.net mvc 4 and finally I made a webside for a student club I am into. Hosting is provided by our school and they only gave me ftp user name and password, I dont know which hosting firm is it or what is going on and so on, I got Filezilla to delete and unpublish the old webside, and I didnt know a proper way to publish asp.net websides through filezilla so I used VS 2012 publish tool.
I choosed FTP as publish method because I had ftp user name... I choosed relase as configuration and thats it ( I didnt open options here ) finally I could push on publish...
I faced 2 main problems so I couldnt publish
Problems I faced were;
1) While I was trying to publish I got an error like
" Validation (HTML5): Element 'a' must not be nested within element 'a button' "
I was trying to make a nav with sub items on it, It worked while I was trying it on local host I saw similar problems spoken out here on VS 2010 I tried to make exstensions to VS didnt work out
Anyway I deleted that part from the project and I tried publishing again.
2)It worked out perfect it seemed like no problem occoured. But when I try to open the webside it was saying I had no permisson to view.
I hope I didnt write any off topic staff here just try to tell you my problems so maybe someone can get help like I did from prior topics.
" Validation (HTML5): Element 'a' must not be nested within element 'a
button' "
You cannot have one anchor tag inside another anchor tag. If you have it that will cause you the problem.
Check out this thread to find out valid elements which can be nested inside an Anchor tag.
I had no permisson to view.
You need to give proper read/write permissions for the ApplicationPool Identity on the folder structure you have for your website. Or else IIS Apppool will not be able to get the files and execute them.
Give permissions to AppPool Identity for a particular folder/file. That resource will guide you one how to give you permissions to Application Pool Identity.
Alternatively you can give permissions from FileZilla itself. Simply right click the application root folder and select permissions. Then you can specify permissions from client side itself. But in most of the production cases, we have to add app pool user to the folder/file permissions list manually. But definitely give a try with FileZilla.

JSF 2 f:subview not seeing my changes reflected in the UI

Update It appears I have to rebuild/redeploy the app to see the changes. Anyone know why I have to do this? It's a static .xhtml page. Coming back to update, looks like I just have to stop/restart the server, not a rebuild. I was dumb and didn't try that first, mostly because I have to rebuild/deploy often anyways.
I'm working on a JSF 2 app that uses f:subviews. I'm on one subview where my changes aren't reflected in the UI when I refresh the browser. I've worked on other subviews where I don't have this problem.
I have a batch script which copies my .xhtml files into my installed apps folder. The batch script reports the file is copied over. It's business as usual... If I drill down into this particular installed app, I see my change in the file. Again, seems like business as usual. The change is not reflected in the UI when I refresh, however.
These are simple text changes I'm making, but not seeing.
The problematic subview doesn't appear to be anything special, it's just a p:datatable that's included via a ui:include with a couple of parameters for the data and to give it a unique id. If I replace the p:datatable with just simple text, the "old" table still shows up in the UI when I refresh. I just can't get any changes in this subview to be reflected in the UI.
Console doesn't throw any errors.
I'm using WebSphere 7.0.
Never encountered this problem before. It isn't a browser caching issue as I can edit other subviews and see those changes when I refresh the page.
Anyone have any ideas?

What causes the asp.net Cannot create/shadow copy error?

Several times a day I receive this error while running my asp.net mvc4 project. I am not asking what that means, or how to fix it, but what am I doing to cause it? It is really starting to bug me, and if I can cause it to go away by altering my workflow I will.
Cannot create/shadow copy '< assembly >' when that file already exists.
As I mentioned above the project is an MVC4 application. My workflow is typically.
Make a change (code or html)
If it was code, rebuild the project (using keyboard shortcut CTRL+SHIFT+B)
refresh the page
see annoying error
clean the solution
rebuild solution
refresh page
verify change
goto 10
(I get the error with/without the debugger attached.) I will be eternally grateful to anyone who can inform me on how to avoid this error, and will promptly tweet your praises
I find this annoying too. It seems to happen when you try to refresh the page in a browser before the build is fully complete. Try counting to three-one-thousand after build is complete and then refresh in the browser. Create/shadow copy should be done by that point.
I also don't think you should need to "clean solution". I believe a rebuild is a clean + build, so you may be cleaning twice.
After a bit of research, I also found this pre-build event which seems to be popular. (this workaround does not seem to work, perhaps it did in previous versions of VS / .NET framework)
Update: alternate solution
Another way to get by this is, when you see the YSOD, just type in a different URL in the browser and load it instead. Then click the back button and refresh to get to the page you were trying to reload in the first place.
What's causing this error seems to be doing the shadow copy (stating the obvious...), ie generating a file in one folder and then reading it to copy it elsewhere. I think what's causing the issue is generating or not that first file, and when/how it's copied, regardless of what your actions are. Does this first file (that will be shadow copied) needs regenerating, and therefore re-shadow copied?
This post says:
By default shadow copy is enabled on every appdomain created by ASP.NET. Assemblies loaded will be copied to a shadow copy cache directory, and will be used from there. So that the original file is not locked and can be modified.
And their fix is to prevent shadow copy. But I don't personnally fully understand what shadow copy does in the asp.net context, maybe someone can clarify if there are any bad side effect to disabling it:
<configuration>
<system.web>
<hostingEnvironment shadowCopyBinAssemblies="false" />
</system.web>
</configuration>
This post talks about disabling indexing and/or antivirus, which would suggest that building the project generates new files, and the antivirus (or indexing service) accesses them and locks them, just when the shadow copy is trying to copy that exact same file.
I get his error regularly and never found what specific action I do causes the error. I make a code change, press F5 (Run/ Play button), get the error in the web browser, close the web browser, press F5 again. It now works. I don't clean, I don't rebuild. However, with the second F5/Run, I believe VS detects there's been no code change, and therefore, maybe the shadow copy is not redone? Or maybe this time the shadow copy is timed slightly differently and it works.
I received this error after adding a new image to my web project.
In VS, each image has a property entitled "Copy to Output Directory". I chose "Copy Always", then I got the message.
I changed it to "Do Not Copy" - now it is happy.
Hope that helps someone.

MVC 4 - Upload Doesn't Work in IE When deployed to IIS 7.5

This problem only happens when I deploy this to our live server, it works fine on my development machine in the visual studio web server, and it is only a problem in IE (8 & 9 both)
Posting a jpeg with this form...
<form method="post" id="uploadForm" enctype="multipart/form-data" action="/ImageUpload/UploadImageNew">
<input type="file" onchange="postFile()" name="file"></div>
<input type="submit" value="OK">
</form>
Using this javascript...
function postFile(ctrl) {
document.getElementById('uploadForm').submit();
}
To this controller...
[HttpPost]
public ActionResult UploadImageNew(HttpPostedFileBase file)
{
// Verify that the user selected a file
if (file != null && file.ContentLength > 0)
{
file.SaveAs("AFilename.file");
}
else
{
throw new Exception("File not found")
}
return View("UploadImageNew");
}
Results in file.ContentLength = 0 in IE, but it works fine in FF & Chrome, the machine is on our Intranet if that makes any difference.
Any help greatly appreciated
UPDATE 1:
Weirdly it seems that the problem is intermittent, on Friday my colleague could not upload anything but I could, this morning it is me who can't and my colleague can both using IE.
Everything seems to point to an IIS config problem?
UPDATE 2:
Ok, it looks like my issue is related to expired sessions / security. I am using a Hybrid Authentication Method and it is causing me problems.
The main site uses forms authentication, however I have another site which does windows authentication for me and sets the cookies, disabling this fixed the issue for me.
Not sure why yet but I think this would be better in another question.
I am marking smartcaveman's answer as the right one, because his post lead to me to the right answer/explanation.
Your issue has nothing to do with the IIS. It is broken because you are wiring up using the change event. There are known issues with IE and the change event. A table with the compatibility of different browsers with this event on different HTML elements is available at quirksmode.
Here are a couple of blog articles on the subject:
http://passionatedevelopment.com/blog/2010/03/24/onchange-on-ie-vs-firefox-the-importance-of-cross-browser-test/
http://www.nofluffjuststuff.com/blog/scott_leberknight/2005/04/onclick_versus_onchange_in_ie_and_firefox
The most obvious way that occurs to me to do this is to use the blur and focus methods instead. (Record a value on focus, check it on blur, and if it's different submit).
Update
So, It's still not working? Here's a few other things that are worth looking into.
What happens if you try to get the value from the form field on the client-side, prior to submitting. e.g. function postFile(ctrl) { alert(document.getElementById('uploadForm').value); return false; }. Does it have a value? Also, have you confirmed the feature works on the live environment without the JavaScript? (e.g. just submit the form normally). If it does, then you can be sure the problem is on the front end. If it doesn't then the JS is fine and the problem is on the back-end.
Max Request Length / Max Content Length. In a comment on your post, you said that you have enabled up to 2GB in the maxRequestLength. However, this works a little differently in IIS7 than in IIS6 (or Casini if that was your previous test environment). The details about this are cited in this blog, but in summary you need to make sure that your web.config has the setting in the system.webServer section, and that the value actually represents what you think it does. Details are in the article.
Do you have exception handling and/or logging features in play? Is it possible you are swallowing an exception somewhere that is causing the request to be abandoned? Are there any empty try - catch blocks that might be protecting your view from an underlying error that would otherwise cause the request to fail? If you do have logging enabled, can you isolate a distinction between your attempted usage and your colleague's?
Is there anything different about the file structure on the live site than your development environment? I noticed you have a hard-coded form action /ImageUpload/UploadImageNew target, which could affect the application's ability to match the incoming route.
You said in the comment that the content length is 0, but if the test you used to determine this is what you have in the post, then you may be wrong. Your test is equivalent to file == null || file.ContentLength == 0). There are different implications depending on which is actually the case. If the file is null, then it may related to model binding. If the Content length is 0, then it at least recognized a file is being sent, but something goes wrong when it decides what to do about it. You can check to see if you are actually receiving the file data by looping through the HttpContext.Request.Form collection and writing out the values (That's how we used to do it... in the ASP Classic days). This other post, Valum file upload - Works in Chrome but not IE, Image img = Image.FromStream(Request.InputStream) , says that a user with the same kind of issue found the file content in the Request.Files collection. You won't know for sure until you check. Anyway, if the file data is in one of those places, you know that problem is happening in model binding (and you know the work around until you find the right way to fix it).
I also found something on the Telerik forums that seems to describe something similar that happens with their component (which is really just a wrapper of what you are doing). It points to a possible session time out.
I would suggest going through these items and seeing if any of them reveal more about the problem (at least #1 is sure to).
Last time I have the same problem when I write ajax based UI.I upload the file using the ajax.only Ie create problem for that time.
Not sure but try these link maybe helpful
Ajax file upload not working in IE7
Valum file upload - Works in Chrome but not IE, Image img = Image.FromStream(Request.InputStream)
http://haacked.com/archive/2010/07/16/uploading-files-with-aspnetmvc.aspx
Is you postFile() save file by ajax or form submission ? IE not take the filename (of upload) as chrome and firefox does. When you make upload debug the code and check if they are exist.
The easy solution that worked for me on IE11: Enable Compatibility mode.
For some reason, IE11 was doing two requests to my Upload endpoint... One without the file, that works fine and returns 200 status (but since it doesn't has the file, it's useless for me) and another request with the file... But this second one is always "pending" on the network tab of the Developer Tools inside IE. I couldn't find the reason for this odd behavior. Watching the logs from server I noticed this second request never hit the server.
This however don't solve the problem for everyone since you'll have to ask every user of your system to enable compatibility mode for your website... And it's not a good thing to ask for Internet users.

dhtmlxScheduler using ASP.NET MVC Refresh Error

I am getting an error about incorrect html when I return from the Save view which means the displayed scheduler is not being refreshed to fix the last set of data. Having made a change or addition, it is displayed correctly if I close the website and open it again, so the update has been saved in the table. It is just the refreshing of the currennt view that I am having problems with. Does anybody have any suggestions as to where I might look?
As usual, this was my mistake. I had created a new project and copied the Save.aspx view from another project. The Inherits="System.Web.Mvc.ViewPage<RLSBCWebSite.Controllers.CalendarActionResponseModel>" still referred to the old project.
Make sure you create a new page in your project and copy just the contenets from old projects!

Resources