E
EW Newbie
My apologies in advance if there is a better forum for this question.
Given the following snippet:
<script type="text/c#" runat="server">
protected void Page_Load(Object Sender, EventArgs e)
{
if ( Request.QueryString.Count > 0 )
{
if ( Request.QueryString[ "pid" ] != "" )
{
My problem is as follows,
a) if url is passed with no querystring at all, works as intended
b) if url is passed with querystring "?pid=" (blank), works as intended
c) if url is passed with querystring "?pid=12345", works as intended
d) if url is passed with querystring with misspelled or missing "pid"
element, the script crashes because the [ if ( Request.QueryString[ "pid" ]
!= "" ) ] returns true.
How do I test to ensure that an element ("pid") is present in the
querystring before continuing?
Given the following snippet:
<script type="text/c#" runat="server">
protected void Page_Load(Object Sender, EventArgs e)
{
if ( Request.QueryString.Count > 0 )
{
if ( Request.QueryString[ "pid" ] != "" )
{
My problem is as follows,
a) if url is passed with no querystring at all, works as intended
b) if url is passed with querystring "?pid=" (blank), works as intended
c) if url is passed with querystring "?pid=12345", works as intended
d) if url is passed with querystring with misspelled or missing "pid"
element, the script crashes because the [ if ( Request.QueryString[ "pid" ]
!= "" ) ] returns true.
How do I test to ensure that an element ("pid") is present in the
querystring before continuing?