Click here to Skip to main content
11,482,039 members (62,352 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET
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 1:11am
Edited 1-Dec-12 1: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 at 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 at 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)



Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 1 Dec 2012
Copyright © CodeProject, 1999-2015
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