Click here to Skip to main content
13,085,123 members (58,211 online)
Rate this:
 
Please Sign up or sign in to vote.
See more:
Hi,

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

------------------------------------------------------
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 1-Dec-12 0:11am
Updated 1-Dec-12 0:14am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

create the instance of the service and using that call the meethod here..
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
        }
 

    }
  Permalink  
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
Krunal Rohit 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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy |
Web02 | 2.8.170813.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100