In my asp.net web application on page load I grab the current page url and store it in a session variable to track which page the user is on so they can return to it if they enter an admin area, do some navigating around etc. They can then click the return button and will be taken to the page they were on before entering the admin.
This all works in IE8; however in FF and Chrome when in the admin the return link redirects to the custom 404 page I have for the web app.
For testing purposes I added the code I wrote below in with my page load event:
Response.Write((string)Session["navurl"]);// displays "http://somedomain.com/customerror/default.aspx"
Session["navurl"] = currentUrl;//ex. currentUrl = "http://somedomain.com/contact/"
Response.Write((string)Session["navurl"]);//ex. currentUrl = "http://somedomain.com/contact/"
Again this works without a problem in IE, but in FF and Chrome on page load the session variable displays the 404 page link and after setting it displays the correct link. I used fiddler to see what was going on and Chrome is throwing a 404 in the GET header for the favicon.ico file, which I am not using in this web app.
I added the faviocon file and the link in the head of the site.master file and Chrome and FF now work fine; I'm still not sure why this is happening. Anyone have an ideas why or how my Session variable is getting overwritten by Chrome or FF?
As a side note I have stepped thru the process debugging and currentUrl is the proper url.
Well, if you are using the .NET handler to serve all pages (ie. all file extensions), then it makes sense that when your browser will make a request for favicon.ico (google to understand what this is), the server fails to find it, and it redirects to a 404. Which in turn modifies the Session variable as "the last page served" : 404.
Now when you render you admin page, and query the Session for "the last page served" what do you get ? "404".
I'd suggest checking the URL to see if it reffers to a user-navigationable page before storing it in session
if (IsAUserPage(currentUrl)
Session["navurl"] = currentUrl;
When you access your admin, are you preserving your session? Using Fiddler have you seen another request for your page? Look for image tags with src="", or iframes.
You must set the Session var on every front end page, but, you never must never set it on the admin pages, only getting to build the "Back" link. If you are using Global.asax events, take care to avoid change the var when serving admin pages.
Related
When I upload a new .aspx file, the server continues showing the old version.
What I've tried:
Forced page refresh: Control+R or Control+F5
Deleted the file on the
server & refreshed page.
Expected result: new page shown (or 404 error when page deleted)
Actual result: old page dhown.
Repro steps:
View https://www.bungalowsoftware.com/subscription/info/default.aspx
The START NOW button shows a link to .../create.aspx
View in File Manager and that button shows link to /buy
RENAME$ /default.aspx to something else (default.disabled.aspx, etc.)
Browse to the site again. Should give a 404, but still shows page.
This is happening with every aspx page I've tested.
Note: if I update or add plain .html files* the new versions show up immediately through the browser.
*in the same directory as the .aspx page I'm testing.
To resolve the cache issue you could follow the below steps:
1)Open Internet Information Services (IIS) Manager.
2)In the Connections pane, go to the site for which you want to disable caching.
3)From the middle pane, double-click HTTP Response Headers.
4)In the HTTP Response Headers pane, click Set Common Headers... in the Actions pane.
5)In the Set Common HTTP Response Headers dialog box, check the box to expire Web content, select Immediately, and then click OK.
Note: After making changes to the iis site folders or pages do not forget to restart iis server or site.
In an ASP.NET Blazor App with Identity I have a page with the page routing
#page "/{PageName}"
When I change the page routing of the login page in Areas/Identity/Pages/Login.cshtml to
#page "/login"
and enter the URL 'localhost:44397/login', the login page shows up as expected.
However, if I follow the link in header bar that I have adapted in LoginDisplay.razor to Log in, the URL changes to 'localhost:44397/login' as expected, but the login page does not appear. Instead, the above page is rendered, where the PageName parameter is set to 'login'.
Endpoint routing obviously works if the URL is entered manually but fails when clicking a link, as if half of the routing middleware would have been bypassed. I tested this with a fresh Blazor template and have no more ideas where to look for the bug.
Accoring to this article, a click on a hyperlink in a Blazor component is intercepted automatically. While the URL in the browser is updated, the request is not sent to the browser but the page is renderd by Blazor. In my case, Blazor can find a suitable page (the one with the #page "/{PageName}" directive) and renders it.
To force loading of the page, NavigationManager can be used:
Login
The href is necessary to render the link with the typical layout. It's probably not the most elegant solution but at least it works.
I am using window.history.pushState(name, title, url); to change the browser URL to let the user know what static url corresponds to an application tab pane.
But Meteor reloads the last real URL (the URL we landed on, before pushState) at each application state change (Meteor reactivity).
How do I change the URL without using a Router.go (that's too heavy for what I am doing, just clicking on a application tab).
OK, I figured it out. The whole route was triggered again (so reloading the page) because I called a reactive function in onAfterAction. pushState is fine. Meteor also. Duh. :)
I have an ASP.NET application I've inherited and am trying to debug. I'm using Page Inspector in VS 2012 Express to work on a particular page that has lots of JS in it. Unfortunately, that page is opened as a popup whose URL is dynamically generated by JS. Page Inspector does not seem to handle this well.
If it just popped out into the new window, that would be OK because I could then get the URL and paste it back into the main PI window. However, it seems to lose the session reference when it pops up, because it logs me out of the application, and when I log back in I lose the location I was at.
I've tried changing the function that does the URL generation / window opening to a window.location.href, but that doesn't seem to work either; it just stays on the same page.
The references to the URL generation functions are done in such a way that it would be a lot of work to switch it from calling a JS function to just a straight link on the page, especially since I would have to switch it back for production.
Any ideas on how I can configure Page Inspector to handle popup windows better?
Thanks.
Ok, so I've done it a hundred time or more, but today - got a new problem.
created a simple html page with an image
uploaded to a server
opened the page in the browser - no problem, all works fine.
created a new app, selected "tab" and insert the tab name, the http and https url
Tried to view the app and got "The page you requested was not found"
I've checked with other iframe tabs that I've built, they all configured the same, yet the new one - fails to load.
I've seen that the interface has changed a bit, Its not unusual that Facebook breaks things from time to time but maybe I'm missing something?
Edit: also, from some reason I don't have the "View App Profile Page" on that app
They changed some things around, profile pages are no longer being made. Check this out http://developers.facebook.com/blog/post/611/
Although I'm still having problems with getting errors when I try to add the app