Click here to Skip to main content
15,898,938 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have created the following code in Global.asax as:

------------------------------------------------------
C#
string val1 = "";

        public override string GetVaryByCustomString(HttpContext context, string custom)
        {
            if (custom == "browser")
            {
                val1 = context.Request.Browser.Browser + "  " + context.Request.Browser.MajorVersion;
                //return context.Request.Browser.Browser + "  " + context.Request.Browser.MajorVersion;
            }
            else
            {
                val1 = base.GetVaryByCustomString(context, custom);
                //return base.GetVaryByCustomString(context, custom);
            }
            return val1;
        }


------------------------------------------------------

Now I want to display this return value (val1) on my web page. I am not finding any method to it. Please help me.

Thanks & regard

IB
Posted
Updated 1-Dec-12 0:14am
v2

1 solution

create the instance of the service and using that call the meethod here..
C#
public partial class Default : System.Web.UI.Page
    {
        Service1 srvc = new Service1();

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Button1_Click(object sender, EventArgs e)
        {
           Response.Write(srvc.GetVaryByCustomString("","").ToString());  // pass the parameters
        }


    }
 
Share this answer
 
Comments
Indrojeet_Bhattacharya 1-Dec-12 6:30am    
I am already passing the parameter as:
<%@ OutputCache Duration="30" VaryByParam="none" VaryByCustom="browser" %>

What I want is to fetch the return values of the method from Global.asax file.

Thanks & regard
IB
[no name] 1-Dec-12 6:33am    
You're not getting my solution.. I don't know your parameters.. Answer is there..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900