What test are you using to make this conclusion? If
InvalidQSParamName is not a defined query string name, then my testing indicates that
Convert.ToString(Request.QueryString["InvalidQSParamName"])== null
I arrived at this conclusion by creating a page named
testpage.aspx.
Markup:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="testpage.aspx.cs" Inherits="TestSpace.testpage" %>
<html>
<head runat="server">
<title>Null Test</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:label id="TestLabel" runat="server" xmlns:asp="#unknown" />
</div>
</form>
</body>
</html>
Code-Behind:
using System;
namespace TestSpace
{
public partial class testpage : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Convert.ToString(Request.QueryString["emptyquery"]) == null)
{
this.TestLabel.Text = "Null";
}
else if (Convert.ToString(Request.QueryString["emptyquery"]) == "")
{
this.TestLabel.Text = "Empty String";
}
}
}
}
The page output is
Null
Perhaps you have inadvertently created a query string name of
InvalidQSParamName with an empty-string value. Try changing the parameter name and see if that gets you the expected results.