Writing javascript code in every page of my site using aspx

Discussion in 'ASP .Net Building Controls' started by Antonio, Jun 4, 2004.

  1. Antonio

    Antonio Guest

    Good Morning,
    I would want to use aspx to write this javascript code for me in every
    page of my site www.etantonio.it how can I do this ???


    <script type="text/javascript"><!--
    google_ad_client = "pub-XXXXXXXXXXXX";
    google_ad_width = 728;
    google_ad_height = 90;
    google_ad_format = "728x90_as";
    google_ad_channel ="";
    google_color_border = ["B4D0DC","A8DDA0","578A24"];
    google_color_bg = ["ECF8FF","EBFFED","CCFF99"];
    google_color_link = ["0000CC","0000CC","00008B"];
    google_color_url = ["008000","008000","00008B"];
    google_color_text = ["6F6F6F","6F6F6F","000000"];
    //--></script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>


    Thanks


    Ing. Antonio D'Ottavio

    www.etantonio.it
     
    Antonio, Jun 4, 2004
    #1
    1. Advertisements

  2. You can create yourself a class derived from System.Web.UI.Page, and have
    that class write the script during OnPreRender. You can have all of your
    aspx pages derive from this base class.

    I haven't tried this, but I believe you can specify a base type for all your
    pages in web.config:

    <configuration>
    <system.web>
    <pages pageBaseType="type">
    </system.web>
    </configuration>--
    John Saunders
    johnwsaundersiii at hotmail
     
    John Saunders, Jun 4, 2004
    #2
    1. Advertisements

  3. Antonio

    Fritz Guest

    Several ways, among them an clientside include file, a document.write call,
    etc.
     
    Fritz, Jun 18, 2004
    #3
  4. Antonio

    Mr. Dot Net Guest

    The best way to do common processing is using inheritance.
    You can create a base class called MySitePage which inherits from
    System.Web.UI.Page
    in it you can write java script registration code and every other commom
    processing logic.
    All the pages in your site must inherit this base class.
     
    Mr. Dot Net, Jul 7, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.