Pagina ASPX (vuota):
codice:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="2968515.aspx.cs" Inherits="Studio2017.HTML.it._2968515" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
Codice della pagina (ogni pagina ha il suo Code-Behind, collegato con l'ereditarietà)
codice:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Studio2017.HTML.it
{
public partial class _2968515 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(URLbuilder());
}
public string URLbuilder()
{
string httpVar = "http";
string address = string.Empty;
string nomeSito = "www.ecc.tld";
if (Request.ServerVariables["HTTPS"].ToUpper() == "ON")
httpVar += "s://";
else
httpVar += "://";
address = httpVar + nomeSito;
return address;
}
}
}