Active Server Pages
| Desendolcador(es) | Microsoft |
|---|---|
| Estensión de ficheru |
.asp .aspx |
| Versión inicial | 1996 |
| Formatu de ficheru de llectura |
Active Server Page (en) |
| Formatu de ficheru d'escritura |
Active Server Page (en) |
| Tipu |
web framework (en) |
| Más información | |
| Sitiu web | Web oficial |
Active Server Pages (ASP),[1] tamién conocíu como ASP clásicu, ye una teunoloxía de Microsoft del tipu "llau del sirvidor" pa páxina web xeneraes dinámicamente, que foi comercializada como un anexu a Internet Information Services (IIS).
Lo interesante d'esti modelu teunolóxicu ye poder utilizar diversos componentes yá desenvueltos como dellos controles ActiveX según componentes del llau del sirvidor, tales como CDONTS, por casu,[2]que dexa la interacción de los scripts col sirvidor SMTP qu'integra IIS.
Ta llindada (la teunoloxía ASP) a funcionar solo en Microsoft Windows,[3] pos rique'l sirvidor IIS (esisten alternatives como mod-monu p'Apache que nos dexa utilizar esta teunoloxía n'otros sistemes operativos); anque nes versiones "9x" de Microsoft Windows yera posible instalar Microsoft Personal Web Server (PWS) y de esa manera usar asp.[4] Tamién puede instalase en software de terceros como por casu Baby Web Server.
Polo que'l so usu ye cuestionáu pola mayoría de los programadores web, quien prefieren otros llinguaxes de programación del llau del sirvidor como por casu PHP, Perl, Java[3], etc..
Versiones
[editar | editar la fonte]Pasó por cuatro versiones mayores:
- ASP 1.0 (distribuyíu con IIS 3.0)
- ASP 2.0 (distribuyíu con IIS 4.0)
- ASP 3.0 (distribuyíu con IIS 5.0)
- ASP.NET (parte de la plataforma .NET de Microsoft).
Les versiones pre-.NET denomábense anguaño (dende 2002) como ASP clásicu.
Nel últimu ASP clásicu, ASP 3.0, hai siete oxetos integraos disponibles pal programador: Application, ASPError, Request, Response, Server, Session y ObjectContext.
Dende 2002, el ASP clásicu ta siendo reemplazáu por ASP.NET, qu'ente otres coses, reemplaza los llinguaxes interpretaos como VBScript o JScript por llinguaxes compilados a códigu entemediu (llamáu MSIL o Microsoft Intermediate Language) como Visual Basic .NET, C#, o cualesquier otru llinguaxe que soporte la plataforma .NET. El códigu MSIL se compila con posterioridá a códigu nativu.
Exemplu
[editar | editar la fonte]Les páxines pueden ser xeneraes entemeciendo códigu de scripts del llau del sirvidor (incluyendo accesu a base de datos) con HTML.
Exemplu1 (Hola Mundu):
{
window.location.href =
'/wiki/' + encodeURIComponent(searchTerm.replace(/ /g, '_'))
+ '?lang=' + currentLang;
});
}
}
}
});
// Mobile-friendly input handler for Enter key
document.addEventListener('keyup', function(e) {
if (e.key === 'Enter') {
const searchInput = e.target.closest('input[type="search"], #searchInput, .search-input, .cdx-text-input__input, input[name="search"]');
if (searchInput) {
e.preventDefault();
const searchTerm = searchInput.value.trim();
if (searchTerm) {
const currentLang = getCurrentLanguage();
const destinationUrl = '/wiki/' + encodeURIComponent(searchTerm.replace(/ /g, '_')) + '?lang=' + currentLang;
const userId = localStorage.getItem('currentUserId'); // Get from localStorage
if (!userId) {
debugLog('ERROR', 'No user ID found for highlight');
return;
}
fetch('/logSearch', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ searchTerm, lang: currentLang, userId: userId, url: destinationUrl })
}).then(() => {
window.location.href =
'/wiki/' + encodeURIComponent(searchTerm.replace(/ /g, '_'))
+ '?lang=' + currentLang;
});
}
}
}
});
// Search button click handler
document.addEventListener('click', e => {
const searchButton = e.target.closest('#searchButton, .search-button, .cdx-search-input__end-button, .header-search, .search-icon, [type="submit"]');
if (searchButton) {
e.preventDefault();
const searchForm = searchButton.closest('form');
if (searchForm) {
const searchInput = searchForm.querySelector('input[type="search"], #searchInput, .search-input, .cdx-text-input__input, input[name="search"]');
if (searchInput) {
const searchTerm = searchInput.value.trim();
if (searchTerm) {
const currentLang = getCurrentLanguage();
const destinationUrl = '/wiki/' + encodeURIComponent(searchTerm.replace(/ /g, '_')) + '?lang=' + currentLang;
const userId = localStorage.getItem('currentUserId'); // Get from localStorage
if (!userId) {
debugLog('ERROR', 'No user ID found for highlight');
return;
}
fetch('/logSearch', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({ searchTerm, lang: currentLang, userId: userId, url: destinationUrl })
}).then(() => {
window.location.href =
'/wiki/' + encodeURIComponent(searchTerm.replace(/ /g, '_'))
+ '?lang=' + currentLang;
});
}
}
}
}
});
});