Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Request.QueryString()
Message
De
29/07/2003 16:13:37
 
 
À
29/07/2003 16:10:36
Jerry Tovar
Dana Corporation Dana It
Maumee, Ohio, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00814648
Message ID:
00814698
Vues:
11
No problem, glad it worked ... although I think Cathi's suggestion was probably better. =)

~~Bonnie


>Thanks, this works.
>
>Jerry
>
>
>
>
>>Jerry,
>>
>>Just check to see if it's null first before attempting to process it:
>>
>>  if (Request.QueryString["myKey"] != null)
>>      lcKey = Request.QueryString["myKey"];
>>
>>
>>~~Bonnie
>>
>>
>>>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
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform