I am working on one old ASP.NET MVC version 3 project. I am banging my head against wall for one weird issue. Issue is like in following line of code in cshtml view Session["FirmName"] is always showing old value after page refresh.
<label class='switchValue' id="switchClientName" title="#Convert.ToString(Session["FirmName"])">#Convert.ToString(Session["FirmName"])</label>
When page reloads there is code to change Session["FirmName"]. This issue is not reproduced in our local environment but is seen only in production. What is there which is making Session["FirmName"] to be cached? Is it something related with caching? Any help greatly appreciate.
To resolve caching issue, I created a parameter in querystring & passed current DateTime value to it.
Related
I am running an instance of Umbraco 6.1.x and it has started throwing 404 on published pages.
My page structure is as follows,
Content
Home
About
Course
...
Component
Home
About
Course
Where component holds all resources and modules (HTML sections and stuff) for a page and using a partial view macro I dynamically load all components at runtime for a specific page.
We are facing an issue where we get 404 on every page after a full republish once we hit the HomePage. Before hitting home page they are all fine, but the moment we hit the homepage they are all throwing 404. By overriding the handlers I found out that they are hitting ~/umbraco/RenderMvc!
Any idea what can cause this?
Thanks in advance.
EDIT:
It is actually throwing:
No template exists to render the document at url '/'
considering the aforementioned scenario.
I have proper allowed template setup and property on nodes are showing the correct template associated with the respective items. Not sure why it's losing template info. I can force it to load under correct template using ?altTemplate=templateName.
Some pointers, we have a view in Views/Shared folder (apart from macro partials) tied to a surface controller.
One thing I would like to say is, we are using nested (library.RenderMacroContent with Umbraco markup) in our partial views and I have realized that the whole page throws 404 if there's a page with a link to the broken page which is broken (i.e. page got re-created and on t==e of the components is holding a link to the page with previous id). Suggestions?
did you get to the bottom of this? We're having exactly the same problem at the moment, on the same version of Umbraco.
I've noticed that when it happens, the umbraco.config becomes either corrupt or rolls back to a much, much earlier version, with all sorts of attributes missing. This lead us to believe it was a sync issue between the DB and umbraco.config.
We initially thought we had solved it by deleting App_Data > TEMP > ExamineIndex and recycling the app pool etc. Maybe give this ago, as it fixed it for a while for us, but alas, the demon has reared its ugly head once more. We are still in a full on dev stage though, so the constant changing may be complicating it further for us - perhaps it will be a fix for you.
If you have any more info, or even a fix, it would be greatly appreciated.
Cheers
EDIT:
Ok, I think I've solved this now, but only time will tell. Try emptying your recycle bin & then republish entire site.
I managed to consistently recreate the bug using IIS SEO site analysis. Each time I did this, the log threw up an error 'cannot find node id xyz', turns out that (and other) nodes were in the recycle bin. Upon emptying it the errors stopped. Good luck!
Has anyone seen an ASP.NET MVC 4 partial view render like this before?
Of three development workstations, two display the it correctly, and one does this. Obviously, it is something with the configuration of the third machine, but I cannot seem to figure out what.
Are you using VS2013 Preview? If so, there was a bug with ASP.NET partial render, try getting a newer version.
Show your code.
Keep in mind that partial view code has changed from MVC3 to MVC4.
An example would given in your compiler.
Or look here: http://www.asp.net/mvc
I am working on MVC4 project and facing a problem.The project on which i am working was developed in web forms.The html of pages is already saved in Database.I am getting this html from DB and showing it on Views. Now the problem is that this Html aslo contains Images and links and these are working fine in web forms application but in MVC images and links are not working i.e images fail to load due to invalid path although i have made the same folder structure. Here is an example.
Suppose i have an image in folder App_Themes/Theme1/Img/download_icon.gif. Now in MVC project if i give this image the src like /App_Themes/Theme1/Img/download_icon.gif it is loaded correctly but if i give it the src like App_Themes/Theme1/Img/download_icon.gif it does not load and this is saved in Db. My question is how can i load all images correctly that come from Db in html?
You got a tricky scenario. Its always a bad practice to keep Html tags in database because it may cause these kind of issues in future, which gives head aches to current developer working on that. As per my opinion there is no solution, but I am suggesting a work around for you to overcome this. This is an issue with virtual directory and hope that we can resloved by Url.content.
Any way your are getting the html from database. So I believe that you have something similar to this.
string htmlContent = getHtmlforPage1()
it will returns you all the html for page one and you use HtmlString() to show it in your view.
You can replace the <img src=blah\blah.img /> with "<img src="+ Url.Content(blah\blah.img") />. all you need is to write down a function to achieve this.
This question will gives you about the need for url.content()
why use #Url.Content
If possible please change avoid storing html in database
I am facing a very annoying problem with the kendoui grid of kendo-ui version 2013.1.514.
Following the demo on http://demos.kendoui.com/web/grid/editing.html I created a small demo app for updating employees in a database.
Pretty simple.
Now as soon as I add or update some employee in the grid and press save, the server handlers are called as expected and everything works fine. However, when the handlers are done, back on the client I get this awful script error: "kendo.all.min.js SCRIPT1004: Expected';'"
I already searched through the web and all i found for this problem was that you should make sure, you load the KENDO and other JS scripts in the right order.
However, as I am using the KENDO project template for MVC, I never changed anything in the order of the js files, as they were already created by the project wizard.
I also added a sample solution, that you can get from: http://sdrv.ms/12x0Zw3
Please tell me what I am doing wrong?
Ok.. figured it out.
In my action methods I just returned the viewmodels that were passed in.
However, the grid expects the updated viemodels (e.g.: viewmodel for added item has id==0 when it comes in, but should be returned with a valid id > 0)
An excellent description can be found in the docs of telerik:
http://docs.kendoui.com/getting-started/using-kendo-with/aspnet-mvc/helpers/grid/batch-editing
I'm stuck with a bug at the moment which is puzzling me. I have a
layout containing some HTML and a partial (for the navigation) - there
is nothing else there other than the yield.
If the nav is included as a partial I get nothing returned to the
browser at all (blank page) but everything else appears normal
If I remove the partial the page works fine
If I put the nav code directly in the template it works fine
if I replace the nav code in the partial with a simple string, I get
a blank page again.
Does anyone have any ideas as to what the problem could be, or know how
I might debug it?
Found the issue, the partial was in the layouts folder, instead of the
relevant controller views folder.
However, Rails was throwing a ActionView::MissingTemplate Exception
which was only visible via the debugger which is probably a bug.
First off, check the log file to see if you're getting an error message somewhere. If that doesn't help follow these steps:
Make a copy of your template & partial, linked as the original
Test that they exhibit the problem
Start removing things from them until you have the simplest possible case that still exhibits the problem (your string in the partial test is a step in this direction)
If you don't figure it out in that process, come back and edit your question to include the code for the simplified case
I have had this error on a number of occasions. The problem has always been solved by changing something in the offending template or one of it's partials (in my latest case, I added a blank line into the source between a </div> and a <div>, which was in a partial invoked by the template; changing the template itself had no effect). The really odd thing is that the problem rarely occurs when I actually change a template, but usually when I change something related (e.g. edit an image displayed in the page or the CSS relating to the page). While the problem is often related to a partial, the entire page is blank, not just the portion provided by the partial.
BTW, restarting the web server (in this case Unicorn) does not fix the problem. Running Ruby 1.9.3, Rails 3.1.3. Using SASS and Unicorn.
UPDATE: Just determined that Rails is returning a 304-not modified, based upon the "If-none-match" header sent by my browser (which in turn was based upon the ETAG of the previous page). However, in the meantime, the browser cleared the window. So, presumably, something in what Rails sent caused the browser to clear the window.