How To Avoid To Cache The User Control In Mvc

Nov 12, 2010

I add cache to my application, I have a page which contains several User Control, my problem is I just want to cache the data returned from Controller, but not want to cache all the page content. Since one of my user control is login control, if I cache all the result, then it will behave incorrectly.

my problem is :

1.Is it possible to just cache the data returned from controller ?

2.If a page is cached, can I force a control in the page to be uncached ?

View 2 Replies


Similar Messages:

How To Avoid Initialization Of Web User Control Inside Aspx

Feb 23, 2010

I have an aspx page which contains a web user control as below.

[code]...

In the Page_Load method of the above page I am setting the Visible = true/false (based on some condition) for the WebUserControl1. WebUserControl1 contains lots of control itself. But I don't want to initialize the controls inside WebUserControl1. Is there anyway we can avoid initializing the ChildControls of WebUserControl1?

View 2 Replies

Web Forms :: Avoid Reloading User Control Between Pages?

Jan 31, 2011

I have a user control which is used by several pages on my site. I would like the state of the controls within this user control to persist as I move from page to page, but presently any such page navigation causes the user control to reload from it's original state.

I have also noticed that this problem extends to the event handling methods of the controls on the user control. After executing the event handling method in the code behind file the page refreshes and the user control is reloaded from it's original state.

Is there a way to prevent this user control from reloading it's original state?

View 1 Replies

Avoid Getting Data From Entity Framework's Cache

Jun 9, 2010

I have a weired problem. One of the pages in my application show's status of tasks in a table. I am using entity framework ( entity to object) to do all the data handling with DB. I noticed that even though the status is updated in DB, its not reflected on my webpage even after continuous refresh! If i stop the server and start the application again (currently running on VS2008 dev server) the updated data is displayed!

Am I seeing the cached data? how do I prevent this from happening?

View 1 Replies

AJAX :: Validate Rating Control To Avoid Multiple Ratings By User

May 7, 2015

I am usingĀ [URL] ....

And my question is the user should not vote again if he/she already voted....

View 1 Replies

Queue Access To The Database To Avoid Multiple Cache Items?

Jun 7, 2010

I have a music related ASP.NET web site which caches a lot of static information from the database on the first request.Sometimes, the application is reset and cache is cleared while the application is on heavy load and then all http requests go to the database to retrieve that static data and cache it for other requests.

How can I ensure that only one request go to the database and cache the results, so that other request simply read that info from cache and not needlessly retrieve the same info over and over again.Can I use thread locking? For example, can I do something like lock(this) { db access here }?

View 2 Replies

Web Forms :: Trying To Cache 2 User Control In Page?

Feb 11, 2011

i am trying to cache 2 user control in my page. These user control pulls inforamtion from Database and shows the information. (like top review etc).

It works fine if i dont add

[Code]....

in my user controls. but as soon as i add above code in my user controls then i get error.

Sys.ArgumentUndefineException: Value cannot be undefined. Parameter name:type

at the left bottom of the page.

This occurs when i navigate to different page and come back to page which has user control

View 1 Replies

Caching User Control And Clearing That Cache Programmatically?

Jul 13, 2010

I'm trying to cache user controls and on some pages i want to cache single objects. There are multiple ways of implementing caching, and my head is breaking over it.

The way I see the caching options now:

You have the PartialCaching option which is set to cache the control for 30 minutes, and after that it clears itself... You have the varyByParam to identity the page by its querystring paramaters... or other vary options

But i just cant find an appropriate way to add caching to a control, and be able to clear the caching programmatically when i update one of the objects used in the control from the backend.

You can do HttpContext.Current.Cache.Insert(), which accepts a key on which you can destroy the caching item later by using remove... This can save objects in cache but can you use options like varyByParam?

My questions are burnt down to two:

Is there a way to clear the caching on specific user controls from the code? If yes, can this be done according to the varyby options? How would the object caching respond to logged in users or anonymous users using Insert()?

EDIT: I'm caching multiple things.... And I'm really flabbergasted in which choice to make referring to caching. Can the Cache.Insert be varied by Parameters?

The main problem is peopling editing things from the backend, which needs to trigger an event that reinstantiates or clears all caching items referring that object.

View 2 Replies

Web Forms :: Clear Cache On User Control With Vary By Id Parameter

Aug 1, 2010

I have a page that deploys a user control to display an article. The page will show a different article depending on the ID parameter fed in via querystring, and there are many thousands of articles in our db. Here is the problem: I need to cache the user control to improve performance. But editors constantly need to go in and make changes/corrections, which they want to appear instantly on the site. Is it possible to clear the cache for a specific article only once it has been edited? ie for the request article.aspx?id=123? If so how would I do this? Otherwise, if the cache is cleared for all our content every time a single piece of content is edited, it will defeat the object of caching in the first place. I have tried using a cache key as recommended here: [URL] However, this apporach suffers from the drawback mentioned above. have also seen that you can set caching up to be cleared by changes to the db. However, the particular table concerned holds content for a number of other sites and would also have the same disadvantage.

View 5 Replies

State Management :: Output Cache To Be Used Only When Parameter Has Changed + Old Question Of User Control Not Answered?

Aug 26, 2010

i have 2 questions about output cache:1.is it just me , or does it seems that it is used only after the second time that the user reaches the webpage? if so, why, and how can i tweak it to my needs? my guess is that it wouldn't be logical to cache every time a user reach a webpage, but only when it happens enough times.2.i know that i can use "varybyparam" for using the output cache when the parameter doesn't change , but it seems that it would use the output cache even if there is no parameter , or if the specified paramter is not there. is there a way to overcome this?3.an old question that somehow marked as "answered" , yet i didn't solve : suppose i created a user control and i gave it values through the CTOR via the aspx file . is it possible to show the values from within the split/design mode? remember that i've talking about ASP.NET and not simply C# winforms . i write this because this question was on :[URL]and the answer that i got was for C# and winforms . i've tried to do the same for ASP.NET , but i've failed.

View 6 Replies

Custom Server Controls :: How To Programmatically Cache A Server Control And Add A Cache Dependency?

Feb 11, 2011

I have a server control that I developed which generates navigation based on a third party CMS API. Currently I am caching this control using the PartialCaching attribute. The CMS uses cache key dependencies to invalidate the cache when a user makes an edit, however in the case of my server control it does not get invalidated and the updated navigation will not show up until the cache expiration set by the PartialCaching attribute.Here is my two part question:

What is the proper way to programmatically cache a server control, without using the PartialCaching attribute, and adding a cache key dependency?

Is it possible to continue to use the PartialCaching attribute and add a cache key dependency?

View 2 Replies

C# - Avoid Multiple Login For The Same User?

Mar 16, 2011

I wanted to stop multiple login of the same user. So, I created a table which keeps track of users who have logged in. When they log in, the data will be entered in the table. When they click on logout, data and session will be removed. The problem is, when they close the browser window without logging out, they won't be able to login ever again.

View 4 Replies

Web Forms :: Cache "OutputCache" - Exclude The "login/register" Control From The Cache?

Nov 10, 2010

I'm using the OutputCache for my pages, and I have a dynamic user control (login/register) . When the user try to sign in, the the control do not change the aspect because I“m using OutputCache. How can I exclude the "login/register" control from the cache?

View 6 Replies

Security :: Avoid Multi User Login?

Apr 19, 2010

in my web application, what i did is when the user login, i check the username and password to the database, if user name and password match then allow to visit next pages and store the user name on Session, now my doubt is more then one user can use the same username and password(if they are friends then they shared their uname and pwd) so, how to avoid multiple use login?

View 2 Replies

Web Forms :: Avoid Concurrent Login For Same User?

Jul 3, 2012

How to avoid concurrent login for same user?

View 1 Replies

Security :: Avoid Multiple User Login With Same Username?

Feb 7, 2011

i have probleM to check the login ,but i found one solution in this site.. AVOID MULTIPLE USER LOGIN, ...IS THER ANY OTHER METHOD TO SOLVE THIS PROBLEM.....

View 1 Replies

Web Forms :: Avoid Duplicate When User Hit Refresh Button?

Feb 16, 2010

I have a receipt page for my clients that will display their info and they will get notify by an email message. Here is the problem: when user hit refresh button from a brownser, it will send duplicate email message to the user.

This is what i have:

protected
void Page_Load(object sender,
EventArgs e)
{ if(!IsPostBack)
SendEmail()
}
protected void SendEmail()
{ //here is my function for email
}

View 5 Replies

Server Controls In User Control Are Null When User Control Serves As A Base User Control ?

Jun 4, 2010

I don't think I understand fully how ASP.NET does inheritance of controls.I have a user control, ucBase, which has an asp.net label in the ascx file. Code behind references the label and it works fine during run time if the control is not a parent for another user parent.

If I have another user control, ucChild, inheriting from ucBase, the label in ucBase's code is always null. ucChild has no controls in its ascx fileThe server controls (like the label) needs to be declared in the ascx file and not created programmatically.What needs to be done for ucBase to see its own controls when it's a parent user control?

View 1 Replies

Cache Combine Two User Data

Mar 15, 2011

I have a master/detail web form and i have implement a caching to hold detail data. i am facing problem that when two user login same time and enter data, cache has combined the data and both user ara getting each other data. i want every user gat his own data.

View 6 Replies

C# - Cache Whole Result Set Or Based On User?

May 17, 2010

In my web application i have statistics which shown for each user separately ie. posts made , posts made today , articles started by and so on...

Each user has his own special statistics.

What is more flexible and "right" to work with one huge DataTable in Cache with whole data from all users and then loop thought DataTable to find certain user data or to cache each user ie. cacheObj + userID...

View 1 Replies

Web Forms :: Cache Or Not The User Basket?

Dec 26, 2010

I developed an ecommerce application.In this application (out of all other user products stuff ) use Sales to products

Here is simple demo:

http://clients.mantis.co.il/EcommerceDemo/

For example
Buy 20 products and the other 2 product with 50% off

And another example
Buy 1 product and the other cost 9.99$

And last example
Baying more than 600$ got 20$ discount

Course calculate this is not so simple, and the GET BASKET event can take time

I wondered what the best way to do it. My 2 options are:

1. Try to cache the user basket.Yes - because this calculate make just one time (until the user change and add product to the basket etc')No - because this object keep on the server, and if I take a situation that many user fill their basket I don't want the server work slower because the consequence of this decision.

2. Of course the opposite to call this calculate each time than its make slow the make basket event but this not "sit" on the sever and I am not afraid of crash the server.

View 1 Replies

.net - Parameterized Query - Use Escaping Characters Technique To Avoid The User Input Errors?

Jan 19, 2011

i have my own DLL (for the data access layer),,i use escaping characters technique to avoid the user input errors ,, but recently i decided to enhance my classes and using parametrized query to prevent all possible errors,Is the modification will be easy or difficult ??how to convert this way to use the parametrized query ..

View 1 Replies

Avoid Posting Twice Gridview Control?

Jan 27, 2011

in the gridview control when user edit the row and click on update button to save and then click on refresh button (IE) it execut the update event again.

how should i avoid if the user click on refresh after it updates the row?

View 2 Replies

State Management :: User Profile Cache?

Apr 5, 2010

I am looking for an elegant (i guess as elegant as it can be) solution to caching a users profile on login (whether it is session, cache, cookie, etc) and keeping it in sync when a users profile is changed. How do you guys handle this? Just simply call a Flush() method in your Save() method that invalidates the cache?

View 1 Replies

Cache User Details For The Duration Of Their Visit?

Jun 15, 2010

I've built a Repository that gets user details

Public Function GetUserByOpenID(ByVal openid As String) As User Implements IUserRepository.GetUserByOpenID
Dim user = (From u In dc.Users
Where u.OpenID = openid
Select u).FirstOrDefault
Return user
End Function

And I'd like to be able to pull those details down IF the user is logged in AND IF the cached data is null.

What is the best way to create a User object that contains all of the users details, and persist it across the entire site for the duration of their visit?

I Was trying this in my Global.asax, but I'm not really happy using Session variables. I'd rather have a single object with all the details inside.

Private Sub BaseGlobal_AcquireRequestState(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.AcquireRequestState
If Session("UserName") Is Nothing AndAlso User.Identity.IsAuthenticated Then
Dim repo As UrbanNow.Core.IUserRepository = New UrbanNow.Core.UserRepository
Dim _user As New UrbanNow.Core.User
_user = repo.GetUserByOpenID(User.Identity.Name)
Session("UserName") = _user.UserName()
Session("UserID") = _user.ID
End If
End Sub

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved