Click here to Skip to main content
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 0:11am
Edited 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 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)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 483
1 Maciej Los 360
2 OriginalGriff 308
3 Yogesh Kumar Tyagi 275
4 CHill60 220
0 OriginalGriff 6,367
1 Sergey Alexandrovich Kryukov 5,296
2 Maciej Los 3,384
3 Peter Leow 3,259
4 DamithSL 2,490


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