get method

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Smurfas
    New Member
    • Jul 2008
    • 30

    get method

    How this looks in ASP C#?
    Or how use get method in ASP C#?

    Code:
    <html>
    <head>
    </head>
    <body>
    <p align="center">This text befor script. Don't change</p>
    <?php
    $id = $_GET['id'];
    
    
    if ($id == "") {
    ?>
    <p align="center">This index.<a href="index.php?id=news">Go to  news?</a></p>
    <?
    }
    if ($id == news) {
    ?>
    <p align="center"><a href="index.php?id=menu">Go to index.php?id=menu ?</a></p>
    <?
    }
    if ($id == menu) {
    ?>
    <p align="center"><a href="index.php">Ther is  "menu", go to index meniu?</a></p>
    <?
    }
    ?>
    <p align="center">This is under script. Don't change</p>
    </body>
    </html>
  • MSwaffer
    New Member
    • Aug 2008
    • 2

    #2
    There are a number of ways depending on how you want to do it.

    Easiest way is to use the Request.Params collection like this:

    string id = Request.Params["id"];

    The Request.Params collection contains your QueryString, Form, Cookies and ServerVariables items and is the quick way to get both your Post and Get variables.

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Get is part of the Querystring, right?

      You can use Request.QuerySt ring["nameOfVar"];

      Comment

      • Smurfas
        New Member
        • Jul 2008
        • 30

        #4
        Thanks, you help me ;]

        But I have another problam.
        How in C# use include? I have php example
        Code:
        if(isset($_GET['index'])) {
        include("news.php");
        } elseif(isset($_GET[2])) { 
        include("2.php");
        } else { 
        include("3.php");
        How this looks in C#? How use include?
        I wont in page center insert another page.

        Comment

        • Curtis Rutland
          Recognized Expert Specialist
          • Apr 2008
          • 3264

          #5
          C# is not a scripting language. It doesn't work that way. As far as I know there is no equivalent for that. If you really want to include a page, you will have to do an HttpWebRequest and Response.Write the resulting html.

          Comment

          • Smurfas
            New Member
            • Jul 2008
            • 30

            #6
            Originally posted by insertAlias
            C# is not a scripting language. It doesn't work that way. As far as I know there is no equivalent for that. If you really want to include a page, you will have to do an HttpWebRequest and Response.Write the resulting html.
            But how put many information in web site?
            If I all information put in one page, very long load.

            How make this site:
            https://support.dell.co m/

            Top and footer allways same, but middle always different. Some includin page...
            Maybe some have Idias?

            Comment

            • Curtis Rutland
              Recognized Expert Specialist
              • Apr 2008
              • 3264

              #7
              Look up a Master Page.



              Master pages are exactly what you need.

              Comment

              Working...