0

I program in PHP and am trying to learn C#, but I'm having some difficulties.

In PHP, I have a function include_once() to include other pages using the global $_GET.

I use this code in PHP with QueryString (i.e.: ?param=add):

if($_GET['param'] == 'add') {
    include_once('pages/caseAdd.php');
} else {
    include_once('pages/caseDefault.php');
}

I wonder how do I make such a process in Visual Studio using C# (ASP.NET).

  • 3
    First, C# is a programming language - it has nothing to do with sending data to he client, or how stuff is put together. That said, are you using ASP.NET MVC or ASP.NET Webforms as web framework? They differ a lot, especially in regards to such questions. – Lucero Mar 16 '13 at 15:39
  • @Lucero, I'm extremely layman in this case because I started recently, but from what I saw in my project, I use ASP.NET Webform. – Gustavo Marttos Mar 16 '13 at 15:44

1 Answers1

0

Instead of PHP, C# compiles the code and you can't do exactly the same thing. Howewer you can create custom user controls (.ascx files), i.e. caseAdd.ascx and caseDefault.ascx, and dynamically load them to a page. Also you can use MVC to provide different actions depending to query string values.

Evgeny Gorb
  • 1,442
  • 2
  • 13
  • 24