Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Request.QueryString()
Message
 
To
29/07/2003 14:39:50
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, United States
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00814648
Message ID:
00814656
Views:
9
Hi Jerry,

You can use Request.QueryString.Count to see if there are any parameters in the QueryString before trying to pull from the Name-Value-Pair.

>I'm using ASP.Net to create a WebForm.
>
>In my Page_Load(), I want to test for IsPostBack and capture parameters if any. Here's what I do.
>
>
>///Page_Load()
>string lcKey;
>if (Page.IsPostBack)
>{
>  lcKey = Request.QueryString["myKey"];
>}
>
>
>However, if Page.IsPostBack = True and there were not any parameters passed, I get this error:
>
>Object reference not set to an instance of an object.
>
>If I have a Request.QueryString["myKey"];, do I have to pass parameters? Or, how can I test for parameters being passed?
>
>Thanks,
>
>Jerry
-----------------------------------------

Cathi Gero, CPA
Prenia Software & Consulting Services
Microsoft C# / .NET MVP
Mere Mortals for .NET MVP
cgero@prenia.com
www.prenia.com
Weblog: blogs.prenia.com/cathi
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform