Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

C# ASP.NET: Detecting the Existence of URL Variable

Status
Not open for further replies.

wbochar

IS-IT--Management
Mar 14, 2003
72
US
I've been useing URL variables with reasonable amount of success -- but I am unsure how to detect if a URL variable has been declared other than sifting through the header manually. In other lnaguages like Cold Fusion I could use somehting like:

isDefined("URL.ID")

I am using url variables for ID's on articles on a website so that they can be bookmarked. If the variable doesnt exist in the URL I want to take a default action. I am just trying to get out of a custom method and hoping for some simple solution that I have overlooked.

tia,

--Wolfgang
 
Code:
if (Page.Request.Params["id"] != null)
{
    // is set
}
else
{
    // is not set
}

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top