views:

20

answers:

1

Does VaryByParam also take into account the control properties and the logged in user? Let's say, I have a custom property: will VaryByParam cache based on unique values to that property?

Update:

I've added the <%@ OutputCache Duration="500" VaryByParam="*" %> to my user control. In the page the control is embedded in, I have this code:

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
    {
        MyControl1.MyId = Convert.ToInt32(DropDownList1.SelectedValue);
    }

I am getting sporadic null values for MyControl1 since I added the caching. Not quite determined why this is the case, yet. My additional question is why am I getting these null reference exceptions? It seems to only occur when I've added the caching code to the user control.

A: 

This question/answer seems to deal with similar issues.

http://stackoverflow.com/questions/568837/caching-a-user-control-in-asp-net

Curtis White