Skip to content

Commit 15ae10e

Browse files
HttpCapabilitiesBase code example update (dotnet#5400)
The previous example created an error: Cannot implicitly convert type 'System.Web.HttpBrowserCapabilitiesBase' to 'System.Web.HttpBrowserCapabilities' The change to the example fixes that issue. I have tested the code and it now works as expected. I hope that my understanding of the issue is correct and that this is the correct change to make.
1 parent 2c90fdd commit 15ae10e

File tree

1 file changed

+3
-3
lines changed
  • samples/snippets/csharp/VS_Snippets_WebNet/HttpCapabilitiesBase.IsMobileDevice/CS

1 file changed

+3
-3
lines changed

samples/snippets/csharp/VS_Snippets_WebNet/HttpCapabilitiesBase.IsMobileDevice/CS/sample_cs.aspx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
void CheckBrowserCaps()
1313
{
1414
String labelText = "";
15-
System.Web.HttpBrowserCapabilities myBrowserCaps = Request.Browser;
16-
if (((System.Web.Configuration.HttpCapabilitiesBase)myBrowserCaps).IsMobileDevice)
15+
System.Web.HttpBrowserCapabilitiesBase myBrowserCaps = Request.Browser;
16+
if (myBrowserCaps.IsMobileDevice)
1717
{
1818
labelText = "Browser is a mobile device.";
1919
}
@@ -39,4 +39,4 @@
3939
</form>
4040
</body>
4141
</html>
42-
<!-- </Snippet1> -->
42+
<!-- </Snippet1> -->

0 commit comments

Comments
 (0)