I have a website with a page that does a crosspage postback using an ASP:Button with a PostBackUrl as such:
<asp:Button ID="FindButton" runat="server" Text="Find" CssClass="button" PostBackUrl="~/TGS/BusinessResults.aspx" meta:resourcekey="FindButtonResource1" />
I do not need information about the previous page other than PreviousPage.IsCrossPagePostBack, so adding a PreviousPageType should not be neccesary.
Problem
I have two machines, one laptop and one desktop. My code works as intended (PreviousPage is not null) on the laptop, but PreviousPage is always null on my desktop with identicical code.
I have the same Visual Studio 2010 installations with the same .NET versions (Used System.Environment.Version to check) on both machines.
Any thoughts?
Edit: as an update, this is no longer neccesary - I fixed my issue (which doesn't really have much to do with this) in a different matter - but as always; i'll include my solution:
I was using some Response.Write to write a loading gif to a website while the actual page loaded, and this messed up some form related things.. I included a base target to the header of the loading gif html and that solved my problem of all links opening in new images.
A null PreviousPage can be caused by a transfer that might be induced through an intervening Web proxy or perhaps a caching appliance inline with the desktop, but not the laptop. I'd pull a Net Monitor and/or ProcMon trace to see if anything like this might be at play. Hope that helps in some way.
Related
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.
Yes, the famous "'Sys' is undefined" Microsoft JS issue.
I've already done about 4 hours of digging and trying every suggestion I can find about it, so before you immediately call this a duplicate, here me out please.
Ultimately, this question is exactly the same as this one, but the accepted answer isn't relevant to my situation, and the OP is no longer an active member.
Background
There are about a hundred pages in this application. Each of them ultimately inherits from the same base class. This base class overrides the Init method and dynamically adds a ScriptManager to it as the first Form control.
On one single page out of them all, I encounter the issue described in the post I linked. I mentioned that the accepted answer was relevant. Here's why:
I'm not making any Sys. calls
My page doesn't have any AJAX-enabled controls on it
My page doesn't have any JavaScript on it
My web.config is accurate, it includes the proper handler entries
The issue is reproducible on both IIS 6.0 and IIS 7+
If I explicitly add a ScriptManager to the page via <asp:ScriptManager />, the ScriptResource.axd include still doesn't render to the output page
I've tried clearing browser history, Temporary ASP.NET Files, rebooting, etc. with no change in behavior
An older version of the application in our UAT environment functions correctly; the base page code nor the web.config file have changed since then
I'm completely stumped. It's an ASP.NET 3.5 web site project running on Win Server 2003 with IIS 6.0 (both Prod and UAT). My developer environment is Win7 with IIS 7.5. Same behavior in both environments.
Question
Does anybody have any ideas? I'm starting to think it's a bug in the ASP.NET 3.5.1 framework...
I've just had a similar issue that I seem to have just resolved.
IF you are overriding any other page lifecyle events on your page other than PageLoad make sure to trigger the base version of the event. E.g. I was using OnPreRenderComplete
protected override void OnPreRenderComplete(EventArgs e)
{
base.OnPreRenderComplete(e); //ADDING THIS LINE FIXED THE PROBLEM
//Add THEAD etc to Gridview
if (gvQueue.Rows.Count > 0)
{
gvQueue.HeaderRow.TableSection = TableRowSection.TableHeader;
}
}
Since you have tried everything else, and because it is reproducible, I can think of 3 possible causes that you can check:
1) The element not being defined correctly.
Make sure that the head element has runat="server" specified. We always provide an id as well, although I don't think that is strictly required:
<head id="HEAD1" runat="server">
2) The code that is causing the exception is being executed prior to the inclusion of the ScriptResource.axd.
To verify whether this is the case or not, I look at what has loaded in the page so far when the exception occurs. If I don't see the resource that is being reported as missing, I know I have an ordering problem.
I have seen this caused by two hooks of Page.Init (or other methods) in the inheritance tree and when this occurs, you cannot guarantee an order of execution.
3) An invalid page structure.
I have seen numerous cases where a misplaced, easily overlooked character, such as a single quote, double quote or < silently wrecks the page or javascript structure.
To verify that this is not the case, I first validate the page in design mode (Edit, Advanced, Validate Document) and correct any errors.
If there are no errors in design mode, I validate the rendered page by copying the source of the rendered page into an empty page within the project and then validating. This process has caught more than one subtle issue in the page structure.
4) If none of the above solve the problem, there could be an issue with the framework. If there is, it could possibly be caused by element names or order in your page. You can try removing or reordering items in your page until the problem goes away.
Hope this helps.
I am really confused about this one. I have some code that runs fine on my development server but I am now trying to get the site working on the sales guys new laptop. None of the image buttons on the website seem to be working for him (they just redirect me back to the websites homepage) whereas they used to on his previous machine.
The only difference between each machine is that his old one was Vista and the new one is Windows 7.
Has anyone come accross this issue?
Some code:
The form:
<div class="form_text"></div>
<div class="form_box_link">
<asp:ImageButton id="LoginSubmitButton" onClick="FLoginWebService" ImageURL="~/Images/login.png" runat="server" />
The code behind (delphi):
procedure TMemberLogin.FLoginWebService(Sender: TObject; e: System.EventArgs);
begin
//Code Removed but using OutputDebugString shows nothing is being done in here
end;
As mentioned, this works everywhere else except on his windows 7 machine.
EDIT: Ok, I have some more information that has helped me. It seems ALL the post back URLs are incorrect. I manually set the PostBackUrl against the ImageButton control and got this part working but ALL other controls that require post backs on the website do not work properly and are posting to the wrong URL's. I am using IIS's rewrite module but this is the only machine that I am having an issue with it on.
I have managed to sort this issue out. It turns out the problem was the URLs ASP.NET was using for the post back. I am not sure what caused this issue (there must be a different setting somewhere) but I have added some JavaScript to the top of my page to sort the issue. ASP.NET initializes a var called theForm so I just did:
theForm.action = window.location.href;
and that sorted the issue out.
Thanks for any comments people have made.
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.
We got strange error last days. ___doPostBack is undefined.
We are building quite advanced website, but not using postbacks much. One of place where postback used is ASP.NET Login Status control.
It is probabalystic, sometimes it is rendered, sometimes - not. For IE, Chrome it works mostly fine, but from FireFox it is quite high chance not to have doPostBack in page source.
Any ideas?
PS: In addition, error happens only on live environment, which uses Windows 2003 & IIS 5.0, dotnet framework is 3.5
Can it be because I am using OutputCache on page level?
Just happened to us: When googlebot or any other bot hits your page before a regular user, the page is cached without any postback options.
We did a simple hack, using different a outputcacheprofile if the request.browser.javascript is false (asp.net sends different versions of the page to those browsers/crawlers/bots)
I had the same problem, but I realized that ASP.NET does not render __doPostback when server controls don't need it.
When I put a gridview or linkbutton that need __doPostback, ASP.NET rendered it.
Yes it might be about the output cache, comment it out and try again please
Usually this happens when you have malformed javascript somewhere on the page (usually, before the __dopostback function).
Have you viewed the page source and looked to see if the __dopostback function is actually rendered in the page, regardless of whether you're getting the error or not?