Skip to content

Commit

Permalink
start
Browse files Browse the repository at this point in the history
  • Loading branch information
Søren Magnusson committed Feb 25, 2015
0 parents commit cd81880
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 0 deletions.
19 changes: 19 additions & 0 deletions Animal.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Animal.aspx.cs" Inherits="Animal" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

<h1>The animal is ... <% Response.Write(Request.QueryString["species"]); %>
<asp:Literal runat="server" Text="<%$ RouteValue:animalName %>"></asp:Literal></h1>

</div>
</form>
</body>
</html>
13 changes: 13 additions & 0 deletions Animal.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Animal : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
32 changes: 32 additions & 0 deletions Default.aspx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="DefaultAnimals" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<p>Links med url parameter</p>
<ul>
<li><a href="Animal.aspx?species=horse">Hest</a></li>
<li><a href="Animal.aspx?species=dog">Hund</a></li>
<li><a href="Animal.aspx?species=cat">Kat</a></li>

</ul>

<p>Links med pæne url (routing)</p>
<ul>
<li><a href="Animal/species/horse">Hest</a></li>
<li><a href="Animal/species/dog">Hund</a></li>
<li><a href="Animal/species/cat">Kat</a></li>

</ul>


</div>
</form>
</body>
</html>
13 changes: 13 additions & 0 deletions Default.aspx.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class DefaultAnimals : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
}
48 changes: 48 additions & 0 deletions Global.asax
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<%@ Application Language="C#" %>
<%@ Import Namespace="System.Web.Routing" %>

<script runat="server">
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("",
"Animal/species/{animalName}",
"~/Animal.aspx");
}
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
void Application_Error(object sender, EventArgs e)
{
// Code that runs when an unhandled error occurs
}
void Session_Start(object sender, EventArgs e)
{
// Code that runs when a new session is started
}
void Session_End(object sender, EventArgs e)
{
// Code that runs when a session ends.
// Note: The Session_End event is raised only when the sessionstate mode
// is set to InProc in the Web.config file. If session mode is set to StateServer
// or SQLServer, the event is not raised.
}
</script>
49 changes: 49 additions & 0 deletions Web.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?xml version="1.0"?>
<!--
Note: As an alternative to hand editing this file you can use the
web admin tool to configure settings for your application. Use
the Website->Asp.Net Configuration option in Visual Studio.
A full list of settings and comments can be found in
machine.config.comments usually located in
\Windows\Microsoft.Net\Framework\vx.x\Config
-->
<configuration>
<appSettings/>
<connectionStrings/>
<!--
For a description of web.config changes see http://go.microsoft.com/fwlink/?LinkId=235367.
The following attributes can be set on the <httpRuntime> tag.
<system.Web>
<httpRuntime targetFramework="4.5.1" />
</system.Web>
-->
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="false" targetFramework="4.5.1"/>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
</configuration>

0 comments on commit cd81880

Please sign in to comment.