Page At One URL Using The Cached Page From Another URL?
Dec 1, 2010
I'm pretty new to ASP.NET and very new to the concept of caching.
Using MCMS 2002, I built a template.aspx page that receives a "person_id" query string and builds pages accordingly. Several different departments at the school where I work are using this template to display faculty biographies. This much is all working correctly.
The Problem
The problems start happening when I try caching the page. When a person visits person_id=16175 on one department's page, then visits the same numeric bio on a different department page, it loads the cached page instead of rebuilding it. The problem, then, is that it has all of the wrong department branding. For example:
[URL]
It's the same person_id, but the URLs are obviously different. It would be great if the template would recognize the different URLs and ignore the cache. I'm assuming that the problem lies in the fact that both pages are being built using the same aspx page on the backend. Here's the OutputCache bit from the aspx page:
I assume I'm doing something wrong here. Hopefully it will be obvious to someone who knows that they're doing. If you need more info, don't hesitate to ask.
I'm implementing Outputcache in my application and it works fine, but the first time always take a lot to load and the next following request will be faster...
I would like to know if there is a way to initiate the page caching on the server side and serve the cached page upon the very first request, rather than have it triggered by the user one first time.
why all the resources in my page are being requested EVERY single time. E.g. my site.css returns the following headers (using fiddler):
HTTP/1.1 200 OK Server: ASP.NET Development Server/9.0.0.0 Date: Mon, 29 Nov 2010 17:36:21 GMT X-AspNet-Version: 2.0.50727 Content-Length: 9093 Cache-Control: public, max-age=2592000 Expires: Wed, 29 Dec 2010 17:36:21 GMT Last-Modified: Mon, 08 Nov 2010 17:20:16 GMT Content-Type: text/css Connection: Close
But every time I hit refresh I see all the resources (css,js,images) getting re-requested. I have control over the headers returned for any and all of these resources, but I haven't figured it out yet.I have even debugged my ASP.NET app and the HttpModule is definitely being asked for the resources again.
EDIT:Ok, I removed must-revalidate, proxy-revalidate from the headers and that is getting me closer to where I want to be, now when I press back it still requests my css/js files when I press back.
Is it possible to detect whether an ASP.NET Page is about to be cached and if so, how?The HttpCachePolicy object provides only set-methods. The VaryByParams name-value collection is useless if values other than "None" and "*" are set as it impossible to enumerate them and you can only access them by key
Lets say you have a page with headers that tell the browser not to cache.Also, this page has already been posted back to itself.Now you hit the refresh button and you click cancel on the IE modal box with the "previously submitted..." message.You get "Webpage has expired". This doesn't happen in FF or Chrome.Is there a way to prevent the "Webpage has expired" message in IE?Since the page isn't cached, I guess IE has nothing to render.But if the page isn't cached and FF and Chrome shows it, I guess they just show the page as previously shown?
"Firstly check if "default.aspx" page is cached on the browser or not; if yes then Response.Redirect("default1.aspx"); else Response.Redirect("default2.aspx")
Is there a way to prevent a page from being cached based on some logic?
I want to cache anonymous access to a page, so I can set VaryByCustom="user" and have some magic in Global.asax's GetVaryByCustomString method. Ok. But I don't actually want to cache the page if the user's authenticated, only if it's not authenticated. Is there a way to specify this kind of thing?
The reason I want the data to not be added to the cache to begin with (instead of added with some random key) is that as the cache grows things get thrown out and I don't want the non-authenticated version to get thrown out.
I Have a TreeView that I populate from a DataTable.Once it has been populated, I Cache the Treeview.If I try to add the cached TreeView control to my page, nothing happens. No errors no nothing.If I create an empty TreeView control on the page and do a "Do Until" loop and add each node to that empty TreeView, that works! but only once. The next time it loops, for some reasion the CachedTree.Nodes.Count = 0.I can't see what I'm doing wrong.
<asp:Content ID="TitleContent1" ContentPlaceHolderID="PageTitlePlaceHolder" runat="Server"> My Page </asp:Content>
This works by placing the content page specific title on the page ("My Page" in this example). Now I want to add a global prefix to the title in my master page for the site name. So I want:
I am using Master page and Content page combination.But how can i access <body> tag and it's event (onload, onunload) of Master page in .aspx page that is not a content page.
I have a master page homeMaster.aspx and many content pages. However the situation is I have few .html pages. Now when a user clicks on a link the html page should get loaded.inside the master page. The problem is these are .html and not content page with .aspx.
I've encountered a problem when I put a treeview in a page which is using master page. The treeview style doesn't apply.For example, I set the nodes with different colors in different levels. But the treeview nodes are still displayed in the default color(bule).
The treeview code is :
[Code]....
If I use these code in a page which doesn't use a master page. The nodes are shown in colors.
Per different user mode, some pages should not be accessible by users unless they have a valid session key.In your opinions -- would it be better to have a list of acceptable pages in the master page, and check if the current page is valid for the current user? Or handle this on every child page?I'm thinking master page, just want to hear what your input would be.
I wrote a page Page method in my aspx page. in web service method I need to call FindControl method return textbox and get text box value. But my findControl will take MasterPage object to iterate.
code.<script type = "text/javascript"> function ShowCurrentDateTime() { $.ajax({ [code]....
But I am getting compiler error when use Page.Master: Reference to non-shared member requires an object reference
How to pass Master Page object or Page to Page method?. So I can use in Sared method.Is there any way I can access Textbox value directly in Page method? I need access couple of controls in Page Method.
How can I use double buffering in asp.net C#?I want smthng like that : I dont want full page refresh when I click a button in a web page.. I think it can be solved with double buffering. When a button clicked for redirect a content page (button-in master page), current page will not go until the redirected page completely load in the background..
I am wondering if there is anyway to grab the html that is generated from an ASP page.I am trying to pull a table from the page,and I foolishly used a static html page so I would not have to be constantly querying the server where this page resides while I tested out my code.The javascript code I wrote to grab to unlabeled table from the page works.Then when I put it into practice with the real page and found that the ASP page does not generate a viewable page with a jquery .get request on the URL.
Is there any way to query the page for the table I need so that the ASP page returns a valid page on request?(I am also limited to using javascript and perl for this,the server where this will reside will not run php and I have no desire to learn ASP.NET to solve this by adding to the issue of proprietary software)
I am a bit confused about these two sequence of events or processes happening in conjunction to each other. Does the page handler executes first or does the somepage.aspx get execute first or do they happen simultaneously?
In my ASP.Net web application, I have a base page that implements functionality that spans all pages of the web application and my web pages derive from this base page. Since there is a single master page for the entire website, I don't want to attach the master page in each of the web pages. So I attached the Master page via the basepage's OnPreInit method as follows:
However, when I switch to Designer view, I get the "Master Page Error"; The page has controls that require a Master Page reference, but noe is specified. Correct the problem in Code View.When I run the application, the webpage shows up correctly.What should be done so that the designer shows up correctly without having to go and set the master page explicitly in each of the web pages?
if users press the browser's back button to reach the prior page..then page should display a message like "web page expired" in asp.net can i use javascript for this?
for example..
there are 4 pages in web sites. 1,2 and 3 can be back. but when the 4th page run then 4th page can not be back... when the user press browser's back button , diaplay ma message "weg page expired".
RSSProducer.aspx: A page that generates RSS (XML) feeds RssConsumer.aspx: A page that retrieves the RSS feeds and displays it to the user in a repeater control. To do this I am using the System.Xml.XmlTextReader to fill a DataSet with tables based on the RSS-XML retrieved from the RSSProducePage. A table within the DataSet is bound to the repeater control.
For example, this is what I have in my RssConsumer.aspx page:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Session("permittedToViewSomeDetail") = True Dim url = "http://localhost/DevSite/RSSProducer.aspx" Dim reader As New System.Xml.XmlTextReader(url) Dim ds As New DataSet() ds.ReadXml(reader) myRssRepeater.DataSource = ds.Tables(2) myRssRepeater.DataBind() End Sub
My problem is that user-authorization details are stored in Session in the RssConsumer page that need to be accessed in the RSSProducer page (in this example it would be Session("permittedToViewSomeDetail") that I need to access in the RSSProducer page); however, the Session identifier is not common between the two. This means that I cannot access the authorization details in the RSSProducer page.
The reason for why is fairly clear to me:
User's browser makes a request to the RssConsumer page Server generates a Session ID (which is stored in a cookie) if there is no existing Session Identifer The RSSConsumer requests the RSSProducer page...which generates a new Session ID every time because no session identifier is ever going to be found.
I tried using cookieless session so that I could pass the SessionID via the URL to the RSSProducer page as an experiment but for some reason the XmlTextReader doesn't work well with this method (but the desired shared session does work). I've hit a brick wall here. Does anyone know how to share session between pages when one page makes a request to the other?