Esempio di file di configurazione per la convalida
Il file di configurazione illustrato mette a disposizione una sezione sulle funzionalità del browser per gli esempi del controllo di convalida. Assegnare a questo file il nome Web.config e inserirlo nella directory dell'applicazione Web. Per compilare e generare l'esempio, vedere le istruzioni fornite in Esempi di controllo di convalida.
<configuration>
<system.web>
<clientTarget>
<add alias="ie5" userAgent="Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0)" />
<add alias="ie4" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
<add alias="uplevel" userAgent="Mozilla/4.0 (compatible; MSIE 4.0; Windows NT 4.0)" />
<add alias="downlevel" userAgent="Unknown" />
</clientTarget>
<browserCaps>
<result type="System.Web.HttpBrowserCapabilities" />
<use var="HTTP_USER_AGENT" />
browser=Unknown
version=0.0
majorversion=0
minorversion=0
frames=false
tables=false
cookies=false
backgroundsounds=false
vbscript=false
javascript=false
javaapplets=false
activexcontrols=false
win16=false
win32=false
beta=false
ak=false
sk=false
aol=false
crawler=false
cdf=false
gold=false
authenticodeupdate=false
tagwriter=System.Web.UI.Html32TextWriter
ecmascriptversion=0.0
msdomversion=0.0
w3cdomversion=0.0
platform=Unknown
clrVersion=0.0
css1=false
css2=false
xml=false
<filter>
<case match="COM\+|\.NET CLR (?'clrVersion'[0-9\.]*)">
clrVersion=${clrVersion}
</case>
</filter>
<filter>
<case match="Windows 95|Win95">
platform=Win95
</case>
<case match="Windows 98|Win98">
platform=Win98
</case>
<case match="Windows NT|WinNT">
platform=WinNT
</case>
<case match="Windows 3.1|Win16">
platform=Win16
</case>
<case match="Windows CE|WinCE">
platform=WinCE
</case>
<case match="Mac_68000|Macintosh.*68K">
platform=Mac68K
</case>
<case match="Mac_PowerPC|Macintosh.*PPC">
platform=MacPPC
</case>
<case match="X11">
platform=UNIX
</case>
<case match="WebTV">
platform=WebTV
</case>
</filter>
<filter>
<case match="16bit|Windows 3.1|Win16">
win16=true
</case>
<case match="Windows 95|Win95|Windows 98|Win98|Windows NT|WinNT|Win32">
win32=true
</case>
</filter>
<filter>
<case match="WebTV/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
browser=WebTV
version=${version}
majorversion=${major}
minorversion=${minor}
tables=true
cookies=true
backgroundsounds=true
<filter match="2" with="${minor}">
javascript=true
ecmascriptversion=1.0
css1=true
</filter>
<filter match="^b" with="${letters}">
beta=true
</filter>
</case>
<case match="Opera[ /](?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))">
browser=Opera
version=${version}
majorversion=${major}
minorversion=${minor}
frames=true
tables=true
cookies=true
javascript=true
ecmascriptversion=1.1
<filter match="[4-9]" with="${major}">
ecmascriptversion=1.3
w3cdomversion=1.0
css1=true
css2=true
xml=true
</filter>
<filter match="^b" with="${letters}">
beta=true
</filter>
</case>
<case match="^Mozilla[^(]*\(compatible; MSIE (?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))(?'extra'.*)">
browser=IE
version=${version}
majorversion=${major}
minorversion=${minor}
<case match="[5-9]\." with="${version}">
frames=true
tables=true
cookies=true
backgroundsounds=true
vbscript=true
javascript=true
javaapplets=true
activexcontrols=true
tagwriter=System.Web.UI.HtmlTextWriter
ecmascriptversion=1.2
msdomversion=${major}${minor}
w3cdomversion=1.0
css1=true
css2=true
xml=true
<filter with="${letters}" match="^b">
beta=true
</filter>
<filter with="${extra}" match="Crawler">
crawler=true
</filter>
</case>
<case match="^4\." with="${version}">
frames=true
tables=true
cookies=true
backgroundsounds=true
vbscript=true
javascript=true
javaapplets=true
activexcontrols=true
tagwriter=System.Web.UI.HtmlTextWriter
ecmascriptversion=1.2
msdomversion=4.0
w3cdomversion=1.0
cdf=true
css1=true
<filter with="${letters}" match="^[ab]">
beta=true
</filter>
<filter with="${extra}" match="Crawler">
crawler=true
</filter>
<filter match="; AOL" with="${extra}">
aol=true
</filter>
<filter match="; Update a;" with="${extra}">
authenticodeupdate=true
</filter>
</case>
<case match="^3\." with="${version}">
frames=true
tables=true
cookies=true
backgroundsounds=true
vbscript=true
javascript=true
javaapplets=true
activexcontrols=true
ecmascriptversion=1.0
css1=true
<filter match="true" with="%{win16}">
javaapplets=false
activexcontrols=false
<filter match="^a" with="${letters}">
beta=true
vbscript=false
javascript=false
</filter>
</filter>
<filter match="Mac68K|MacPPC" with="%{platform}">
vbscript=false
activexcontrols=false
</filter>
<filter match="^B" with="${letters}">
beta=true
</filter>
<filter match="; AK;" with="${extra}">
ak=true
</filter>
<filter match="; SK;" with="${extra}">
sk=true
</filter>
<filter match="; Update a;" with="${extra}">
authenticodeupdate=true
</filter>
<filter match="; AOL" with="${extra}">
aol=true
</filter>
</case>
<case match="^2\." with="${version}">
tables=true
cookies=true
backgroundsounds=true
<filter match="^b" with="${letters}">
beta=true
</filter>
<filter match="; AOL" with="${extra}">
aol=true
</filter>
</case>
<case match="^1\.5" with="${version}">
tables=true
cookies=true
</case>
</case>
<case match="^Microsoft Pocket Internet Explorer/0.6">
browser=PIE
version=1.0
majorversion=1
minorversion=0
tables=true
backgroundsounds=true
platform=WinCE
</case>
<case match="^Mozilla[^(]*\(compatible; MSPIE (?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*))(?'extra'.*)">
browser=PIE
version=${version}
majorversion=${major}
minorversion=${minor}
tables=true
backgroundsounds=true
cookies=true
<case match="2\." with="${version}">
frames=true
</case>
</case>
<case match="^Mozilla/5\.0 \([^)]*\) (Gecko/[-\d]+ )?Netscape6/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
browser=Netscape
version=${version}
majorversion=${major}
minorversion=${minor}
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.5
w3cdomversion=1.0
css1=true
css2=true
xml=true
<filter match="^b" with="${letters}">
beta=true
</filter>
</case>
<case match="^Mozilla/2\.01 \(Compatible\) Oracle\(tm\) PowerBrowser\(tm\)/1\.0a">
browser=PowerBrowser
version=1.5
majorversion=1
minorversion=.5
frames=true
tables=true
cookies=true
vbscript=true
javascript=true
javaapplets=true
platform=Win95
</case>
<case match="^Mozilla/(?'version'(?'major'\d+)(?'minor'\.\d+)(?'letters'\w*)).*">
browser=Netscape
version=${version}
majorversion=${major}
minorversion=${minor}
<filter match="^b" with="${letters}">
beta=true
</filter>
<filter match="Gold" with="${letters}">
gold=true
</filter>
<case match="^[4-9]\." with="${version}">
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.2
w3cdomversion=1.0
css1=true
<filter match="^[5-9]*" with="${minor}">
ecmascriptversion=1.3
</filter>
</case>
<case match="^[2-3]\." with="${version}">
frames=true
tables=true
cookies=true
javascript=true
javaapplets=true
ecmascriptversion=1.1
w3cdomversion=1.0
</case>
</case>
</filter>
<filter>
<case match="Unknown" with="%{browser}">
type=Unknown
</case>
<case>
type=%{browser}%{majorversion}
</case>
</filter>
</browserCaps>
</system.web>
</configuration>
Vedere anche
Esempi di controllo di convalida | Esempio di controllo di convalida base | Esempio di controllo di convalida del campo obbligatorio | Esempio di controllo di convalida di espressione regolare | Esempio di libreria di script per la convalida | Esempio di pagina di prova per la convalida | Sviluppo di un controllo di convalida