Web Development - Configure Caching For Anonymous Only?
Feb 25, 2010
I'm looking for a way to configure caching only for anonymous users only. The reason I'm looking to do this is when users are logged in and they create content they don't immediately see the content. In our old system (linux/php/mysql) we had it configured to cache only the anonymous users and this wasn't an issue.
Right now we have caching setup in the web.config like this
[code]....
I know that I can add a varyByCustom="userName" like this post is talking about. But this doesn't solve my problem. It still caches the users login and the same problem exists.
I am using visual studio 2005 on windows xp sp3. The website is stored on file system. I used subversion to checkout the code from the server.
Here is the issue:
When I run the application for the first time everything is fine. But when I makes changes in the application then I should just be able to see those changes by reloading the page in browser. But it's not happening. I have to stop the development server and re-run the application which will start a new instance of development server and now I can see the changes. This takes like 3-4 minutes and it's a lot of waste of time which I can't afford.
For my fellow developer who is here for a long time everything is just working fine. He can just modify the page and reload the page in browser to see the changes.
Reading some forums on web, I tried to clear the cache of my browser (IE, Firefox) and it's not working. So, it's not a browser's cache issue. It's related to cache in development server.
My question is regarding ASP.NET performance. Does it make things more complex like in PHP when I need to make the site performs better? Do I need to use use caching as well?
I then retrieve the data from the DataTable into an anonymous type:
var feeds = from feed in categoryProducts.AsEnumerable()[code]....
This all works great.
However, I would like to extend the code to perform some evaluation checks (e.g., check that various columns in the DataTable are not NULL) and other pre-processing (e.g., call various functions to build the image URL based on the image ID - which is another column in the DataTable not shown in the code fragment) before I return the resulting rows of the DataTable as an anonymous type to the client-side.Basically, I want to iterate through the DataTable, perform the evaluation checks and pre-processing, while building my anonymous type manually as I go. Or maybe there is a better way to achieve this?
I have a page with a number of user controls, In one of my user controls I have a button event. I turn on output cache for the user control that has the button and vary by control using the ID property of a hidden field control in the user control. whenever I turn on the output cache my button event doesn't fire.
We have a largely asp.net web form team (With some Oracle developers thrown in).
Question 1:
Is it a good idea to start using asp.net MVC which will mean redevelopment of a number of standard controls for not much benefit.
Question 2:
Is it a good idea to hire developers where there most recent skills are with asp.net MVC?
I doubt there is any benefit adopting MVC now, given the 100+ applications in this suite of products, and the maintenance/rework this will cause. Given this, is there any particular reason to hire MVC developers, as they won't be hitting the ground running, which is what I need now.
I am planning to develop a social networking website for student of a particular university with following facilities.
Forum, Blog, Creating profile, creating groups , Adding Friends, managing groups, dating, chatting etc.
Now if I start developing it from scratch, this will take a lot of time..
I couldnt find any CMS which can in developing social networking website.
Additionally, I would like the website to have my own custom design. Also it should have support for AJAX, SEO and integrating third party applications.
How do you know what is better to use for writing new programs? We are now using Access 2007 frontend with an SQL backend and we are going to VB.Net, what would be our next logical step?
My web app (asp VB 2005) uses Windows authentication. If the user isn't part of a specific AD security group they don't get to edit the data; instead I redirect the user to a read-only page.The program works fine in the IDE.I published the web app to my laptop and Disabled anonymous access. When I ran the program I got redirected to the read-only page. I added a write event to the application event log to see what was going on, and found that the WindowsPrincipal.Identity.Name contained my laptop's ID, not my user name.I reassert: anonymous access is disabled in IIS and the web.config file has Windows Authentication.
I am working on an internal application... i setup IIS 7 to use windows authentication since its behind the firewall and on the domain.. there is a "public" side.. and an "internal" side... if your not part of IT.. you should get the public side.. this is just informational.. my problem is that there is 1 or two pcs that are not on the domain and nobody is logged into them.. how can i just redirect anonymous users to another site?
everything i read says you can't use anonymous AND windows auth.. so my thought was to just redirect the anonymous users to another site.. how can you do that?
I am trying to figure out how to get at an anonymous typed object's properties, when that anonymous type isn't created in the current function.
Specifically, I am binding an ASP.NET ListView to LINQ resultset, then trying to process each item in the ItemDataBound event.
Option Explicit On Option Strict On Class MyPageClass Private Sub Bind() Dim items As ItemData = FetchItemData() Dim groups = From s In items Group s By Key = s.GroupId Into Group _ Select GroupID = Key, GroupData = Group ' This works fine: Dim groupId As Integer = groups(0).GroupID lvGroups.DataSource = groups lvGroups.DataBind() End Sub Private Sub lvGroups_ItemDataBound(ByVal sender As Object, ByVal e As ListViewItemEventArgs) Handles lvGroups.ItemDataBound If e.Item.ItemType = ListViewItemType.DataItem Then Dim item As ListViewDataItem = DirectCast(e.Item, ListViewDataItem) Dim groupData = item.DataItem ' This is the anonymous type {GroupId, GroupData} ' Next Line Doesn't Work ' Error: Option Strict disallows late binding Dim groupId As Integer = groupData.GroupId End If End Sub End Class
What do I need to do in lvGroups_ItemDataBound() to get at the item.DataItem.GroupId?
Basically, I have a repeater control, and a Linq query that retrieves some items. Ordinarily I would databind straight to the query and use Eval to populate the template with the results.
However, it doesn't come through in quite the right format - for example, if EndDate is null (it's a DateTime?) then I want to substitute it with "Present". I am using only a couple of the properties in the query result objects.
I use LinqToSql in my project. I have a class called MessageBLL and this class has a method called GetAll which returns List<object>. I returned object because I get data from two tables. Here is my code;
[Code]....
I want to use this in my Default.aspx.cs as like this but intellisense is not show CategoryName :[Code]....suggest me return as IQueryable but I couldn't do it in that way.
I have a Postgre profile provider that runs ok with membership, roles, profiles etc.. But I have a problem.I'm trying to have a anonymous user profile but the provider get an error when I try to save the profile.It says:
Error 23503: insert or update on table "profiles" violates foreign key "pofiles_username_fkey"I configured my web.config with anonymousIdentification enabled, and profile ok, But it seems that when the profile saves, it can not find the anonymous user in the users tables that it's related with profles user. I googled for long time and I think I have all good configurated, but somehow, profiles with anonymous user is not working.
Do any one know how to return an anonymous type. I am using Linq where i need to return the following code
private <What's the return type to be provided here> SampleLinq(Int32 Num) { var query = (from dept in obj.DeptTable where dept.Id == Num select new { dept.DeptName, dept.DeptId }); return (query) }
I'm trying to add a directory for anon access in IIS 7.5. It works under Web Dev but not IIS 7.5
I'm currently using this web.config in the directory. This is a directory with style sheets:
<?xml version="1.0"?>
Note: As an alternative to hand editing this file you can use theweb admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig
I've went to the folder and under Authentication, I've changed anonymous authentication from IIS_USR to pool. This seems to have correct it.
I will reward anyone who provides a very good explanation and resources for understanding this setting. Also, how to apply it globally would be good to know -- for all folders.
I use the sitemap, Web.Sitemap file and the asp:menu control in my website for navigation. It has a few navigation tabs, e.g 'Home', 'First Page', 'Second Page'.....
When I click on the 'Home' tab, it goes to http://www.mywebsite.com/Default.aspx. When I click on the 'First Page' tab, it goes to http://www.mywebsite.com/FirstPage.aspx., and so on....
Everything works as expected.
However, after starting the web application, after a few days a set of weired characters will be inserted to the URL as follows:
I checked with the MSDN and found that the strange characters above is the Anonymous-ID embedded in the URL by asp.net (this is the link: http://msdn.microsoft.com/en-us/library/aa479315.aspx)
The tabs still work, and I can still go to the First Page, Second Page... etc. even with these strange characters embedded in the URL. However, once it appears, the 'SiteMap.CurrentNode' that I use in the codebehind always return null, and I can no longer get the 'SiteMap.CurrentNode.Title' property.
And all the submenu will disappear too (I am not sure if it is caused by the SiteMap.CurrentNode problem above or by something else).
I have explicitly set the cookieless mode for the Anonymous-ID in web.config to "UseCookies" as follows:
but I still get this embedded Anonymous-ID every few days. And once it appears, I have to restart the web application in IIS to fix it. Then it will appear again after two or three days.
how to stop this Anonymous-ID from inserting to the URL?
I'm trying to call a Page Method using a jQuery 'attached' event function, in which I like to use the closure to keep the event target local, as below, but page method calls declare several 'error' functions, and I would like to use one function for all of them. If, in the below code, I was handling an error and not success, how could I use my single, anonymous handler for all 3 error functions?
$(":button").click(function () { var button = this; PageMethods.DoIt( function (a, b, c) { alert(button); }); });
This example passes an anonymous function for the success callback. There is only one of these. If I was passing an error callback, how could I use 'function (e, c, t)' for all 3 error callbacks?
ADDED: What I would like to do here is trigger an AJAX call whenever the user clicks a toggle button (checkbox), but to improve responsiveness, I want to toggle the button state immediately, and only 'untoggle' it if the AJAX call fails.
Now, in my client-side click() event handler, I would like to use anonymous functions inside the scope of click()' so that the functions have access to thethisevent argument, but I don't want to 'declare' three functions for theonTimeout,onError, and 'onAbort arguments of the PageMethods.MyFunction function. if I declare a named function outside of the click handler, it no longer has access to the 'this' parameter of the click() event handler.
Is there an easy way to cache ASP.NET whole page for anonymous users only (forms authentication used)?
Context: I'm making a website where pages displayed to anonymous users are mostly completely static, but the same pages displayed for logged-in users are not.
Of course I can do this by hand through code behind, but I thought there might be a better/easier/faster way.
I am trying to get my code working as per the instruction on [URL]
Public Delegate Function PredicateWrapperDelegate(Of T, A)(ByVal item As T, ByVal argument As A) As Boolean Public Class PredicateWrapper(Of T, A) Private _argument As A Private _wrapperDelegate As PredicateWrapperDelegate(Of T, A) Public Sub New(ByVal argument As A, _ ByVal wrapperDelegate As PredicateWrapperDelegate(Of T, A)) _argument = argument _wrapperDelegate = wrapperDelegate End Sub
Private Function InnerPredicate(ByVal item As T) As Boolean Return _wrapperDelegate(item, _argument) End Function
Public Shared Widening Operator CType( _ ByVal wrapper As PredicateWrapper(Of T, A)) _ As Predicate(Of T) Return New Predicate(Of T)(AddressOf wrapper.InnerPredicate) End Operator End Class
Then I have the function which I have modified to use my department id variable (did)
Function DidMatch(ByVal item As ListDataItem, ByVal did As Integer) As Boolean Return item.AssigneddepartmentID.Equals(did) End Function
Then I try to call it from my code:
Dim children As List(Of String) = toplevel.FindAll(New PredicateWrapper(Of Integer, Integer)(Did, AddressOf DidMatch))
I then get an error on DidMatch ... Error Method 'Public Function DidMatch(item As DeptMenuData, did As Integer) As Boolean' does not have a signature compatible with delegate 'Delegate Function PredicateWrapperDelegate(Of Integer, Integer)(item As Integer, argument As Integer) As Boolean'.
I'd like to be able to determine during the processing of a given request whether the requested URL is to path that allows anonymous users or whether the request is to a path that denies anonymous users.