asp.net multiview issue with Safari - asp.net

I have a very simple page built in asp.net (.NET Framework 4) which has a multiview containing a few views that are displayed as a button is clicked - this seems to work fine on all browsers I have tested with on my local machine but as soon as I move it to the server, the active view doesn't change when the button is clicked when viewing the page with Safari.
I don't see any errors or warnings when debugging (or when viewing the page on another browser on the server). Interestingly, the page displays and works fine on the server if i view it with my iPhone(4S) but trying to browse it using Safari 5.1.2 installed on my PC is where I am seeing the problem.
The code that doesn't appear to be firing is as simple as below and fires on an asp button click:
MultiView1.ActiveViewIndex = 2
Has anyone encountered any similar issues as I haven't been able to find anything much online?
The page in question can be seen at the following URL - http://www.ddlgroup.eu/ArdbegSurvey/survey.aspx

I have check the page and what I think you need to do is to disable any possible cache on browser because the page name is not change from page to page and from post back to post back, and this maybe the problem. Add all this parameters on PageLoad and try again.
Response.Cache.SetExpires(DateTime.UtcNow.AddYears(-4));
Response.Cache.SetValidUntilExpires(false);
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetRevalidation(HttpCacheRevalidation.AllCaches);
Response.Cache.SetNoStore();
Response.ExpiresAbsolute = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0));
Response.Expires = 0;
Response.CacheControl = "no-cache";
Response.AppendHeader("Pragma", "no-cache");
In my safari same version is worked fine - some other error appear on the end of survey.

The issue seemed to stem from accessing the site using Safari through the main business proxy - I don't understand exactly how this could have been an issue but changing to use a different proxy seemed to solve the problem

Related

ASP.NET Web Forms - Button not working inside <iframe> in IE9 and below

I have an ASP.NET Web Forms page that has a form in it and I load it in an <iframe> as a popup.
In all modern browsers it works great.
In IE9 and below, however, things are weird.
One file input element failed to open the file selection dialog when clicking on its browse button.
After fixing this (with a JS trick), I saw another problem. Another button inside the form with this attribute for postback:
onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("btnUpload", "", true, "", "", false, false))"
..failed to invoke the code behind.
When the page loads, it hits my OnLoad() method on the server.
I have searched the whole web trying to find a solution and I have seen others having JS problems inside iframes, but nothing seemed to help.
Does anyone have any idea what may be wrong here?
This is clearly an IE9 problem, but how can I solve it?
UPDATE:
After a few tries, I get an "Access Denied" during the form post, while I shouldn't (It is on the same domain and access should and is allowed).
UPDATE2: I have searched stuff about X-FRAME-OPTION : x-frame-option SAMEORIGIN and clickjacking in ASP.NET but doing this in my Application_BeginRequest doesn't seem to help:
HttpContext.Current.Response.AddHeader("x-frame-options", "SAMEORIGIN");
Related questions:
Get Error WebPage Access is denied in IE
UPDATE3: OK. The access denied is because I send the click to the file input by JS. IE doesn't like it. The mystery of the Browse button not working remains. Perhaps it is a Telerik problem spread to ASP.NET controls: http://www.telerik.com/forums/browse-button-doesnot-workin-ie8#rGGhp26Lm02afXkJNMwQ3g
OK. I have finally solved this one by using the RadUpload instead of the normal Upload ASP.NET control.

How make Firefox see changes to .aspx page?

I created an aspx page and viewed it in Firefox and it worked correctly, running the code. But when I make changes to the page (including deleting everything and serving up a blank page), Firefox continues to show the original compiled aspx page! How can I get it to see the new page?
I even added the following code, but it still loads the original page:
<script runat="server">
Sub Page_Load
Random rd = new Random();
Response.AddHeader("ETag", rd.Next(1111111, 9999999).ToString());
Response.AddHeader("Pragma", "no-cache");
Response.CacheControl = "no-cache";
Response.Cache.SetNoStore();
Response.Expires = -1;
End Sub
</script>
I even cleared Firefox's cache, but it still loads the original version!
EDIT: It appears the issue might be on the ASP.Net side. It's also not changing in Chrome. So, how do I force changes to an aspx file to force a recompiling?
I've had luck with the following code:
// Stop Caching in IE
Response.Cache.SetCacheability(System.Web.HttpCacheability.NoCache);
// Stop Caching in Firefox
Response.Cache.SetNoStore();
Also, your browser may have already cached it prior to when you added the cache prevention code. If so, try hitting CTRL-SHIFT-R in Firefox to force a reload without hitting the cache and see if you still have a problem with Firefox storing cached copies of your page.
Since it appears the issue is not firefox related but something in the ASP.Net web server (since it happens in Chrome as well), I've asked a different question and will close this one.
Yet another way to reload and override cache CTRL + F5
It may also depend on how you are developing your ASP.Net application/site
re-compiling after making changes before viewing again?
If you are building a web application, you have to rebuild (In Visual Studio) your application to reflect any change(s) you made to server side code - this isn't an "ASP.Net issue" it's the norm. You can make changes to the HTML (client side) without re-building, but any server code change will need a rebuild (recompile the dll(s)).
The sample code you have above however, looks like in-line code - is all your code in-line - as in you don't have code behind files (i.e. foo.aspx.vb or foo.aspx.cs)?
All the above is based on local development - obviously if you are viewing your "production"/live site, then it goes without saying that you have to "push"/"publish"/upload/update, whatever local changes you made to it.

How to refresh page when hitting back button on browser (IE,Chrome,Firefox Safari)?

Most browsers reload the page from cache and do not perform a round trip server refresh.
I added Response.AppendHeader("Cache-Control", "no-store") on Page_Load but not working for Chrome, Firefox, Safari.
How to refresh page when hitting back button on browser (IE,Chrome,Firefox Safari) ?
This would be for your c# code I'm assuming.
These are my suggestions in order of most suggested to least.
Response.Cache.SetNoStore();
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.AppendHeader("pragma","no-cache");
Response.Cache.SetExpires(DateTime.Now.AddSeconds(-1));
It's probably a bad idea to force this behavior because the user is expecting to see what they saw before, not a refreshed view. If that's the behavior of Chrome/Firefox/Safari then presumably the users desire this behavior because they chose that browser. If they want a refreshed view, they can refresh on their own.
That said, I often see this done with Javascript in the browser. You can hook into page load events and manually refresh if you see the page being loaded a second time. But if the client uses noscript, or otherwise doesn't support Javascript, then you're out of luck. Also, be careful to reload correctly so that users don't get taken to a new page every time they click Back and get stuck in a battle of fast-clicking reflexes.

Postback intermittently not working with ASP.NET 3.5 and IE?

We have an ASP.NET application that we recently migrated onto a new server with IIS7 and .NET 3.5.
In this new environment, some users that are on IE (6, 7, or 8) are experiencing bizarre intermittent problems with postback not working on ASP.NET buttons. (you click the button and nothing happens)
The issue happens sporadically. Sometimes it works, sometimes it doesn't. For some users the button postback almost never works (but sometimes yes!). To complicate matters there are some pages with asp.net button postbacks that DO always work.
Other pages contain a mix of 'asp buttons' and 'asp link buttons', in which the asp button postbacks often don't work, but the link button postbacks always work.
Javascript is enabled and works. The source DOES contain valid tags.
I actually managed to take View Source snapshots of the same page when it was working and when it was not working and the source was EXACTLY the same!!!
At first I thought it was a problem with IE6, but it's now been reproduced on IE7 on one user's machine.
How would I even BEGIN to tackle this problem?
Any help, ideas, or guidance would be vastly appreciated. I am at the end of my mental rope here.
I know this topic is pretty old, but I found the same problem in my code.
I am using the ComponentArt component library.
In certain circumstances after a postback, buttons with codebehind will no longer execute in IE. I also noticed that buttons with onClientSide clicks would execute their postback when the JS function completes and returns true.
I was able to get all the buttons on the page to submit by adding the following code to my buttons:
OnClientClick="javascript:return true"
Any buttons that are already running a JS function and returning true, should work without issue.
See if this post helps? IE 6 treats buttons a little differently, especially if you have some name conflicts. I could see this being a problem for events if that is the case.
Found the culprit.
It was ComponentArt's 2007 Web.UI components that were being dropped on the page.
Apparently the menu control mixed with the 3.5 framework causes wierd issues with postback not working.

IE6 postback in asp.net

I have a page that contains a user control that is just a personalized dropdown list . I assign to each item the attribute onClick=__doPostBack('actrl',0).
when I click the page postback fine and I got the expected results. However in IE6 my page doesn't change to the new values loaded from the server.
The weird thing is that when I shift + click on the link The page reload fine with all changes.
I tried to disable caching on the page but no luck.
using all this code
Response.CacheControl = "no-cache"
Response.AddHeader("Pragma", "no-cache")
Response.Expires = -1
Response.Cache.SetExpires(DateTime.UtcNow.AddMinutes(-1))
Response.Cache.SetCacheability(HttpCacheability.NoCache)
Page.Response.Cache.SetExpires(DateTime.Now.AddDays(-30))
Page.Response.Cache.SetCacheability(HttpCacheability.NoCache)
Page.Response.Cache.SetNoServerCaching()
Page.Response.Cache.SetNoStore()
Response.Cache.SetNoStore()
Also when I debug the application I can see that the generated html to be rendered is correct, but it is not rendered.
This problem happens only in IE6.
This is a known IE6 bug (#223) with magical HTTP get requests.
See the bug here:
http://webbugtrack.blogspot.com/2007/09/bug-223-magical-http-get-requests-in.html
It happens when an inline event handler causes a page change in IE6.
The problem is that IE6 is not reloading the page from the server (its just grabbing the cached copy), however on a form post IE6 SHOULD reload. Why are you adding the _doPostBack as an attribute, those should be autogenerated on any asp.net control that needs to post back.

Resources