I would like to know how Can I paas Page as Ref Parameter to a function
This is what I want to do
public partial class HomePage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if(!SetupUserPermission.isSessionExpired()) { string UserId = Session['UserId'].ToString(); SetupUserPermission.SetupUserRights(ref this.Page, Convert.ToInt32(UserId)); } } }
You can’t pass a property by reference in C#. Why do you want to pass Page by reference in this case?
In VB you can pass a property by reference, and the equivalent in this case would be:
Are you really sure you want to do that?
I suspect you don’t really want to pass it by reference, and you’re just slightly confused about parameter passing. See my article on the topic for more information.