R
rn5a
Consider the following 2 code snippets:
-----------------------------------------------
<script runat="server">
Dim strName As String =
System.Web.HttpContext.Current.Request.Form("txtName")
Sub Page_Load(......)
.................
.................
End Sub
'some more Subs here
</script>
-----------------------------------------------
-----------------------------------------------
<script runat="server">
Dim strName As String = Request.Form("txtName")
Sub Page_Load(......)
.................
.................
End Sub
'some more Subs here
</script>
-----------------------------------------------
Note that in both the code snippets, the variable strName has been
declared & assigned a value outside any sub-routine.
The first code snippet works fine but the second code snippet
generates the following error:
**********************
Request is not available in this context.
**********************
pointing to the Dim strName... line. Can someone please explain me why
does the second code snippet generate the above error & why does the
first code snippet work fine?
Thanks.........
-----------------------------------------------
<script runat="server">
Dim strName As String =
System.Web.HttpContext.Current.Request.Form("txtName")
Sub Page_Load(......)
.................
.................
End Sub
'some more Subs here
</script>
-----------------------------------------------
-----------------------------------------------
<script runat="server">
Dim strName As String = Request.Form("txtName")
Sub Page_Load(......)
.................
.................
End Sub
'some more Subs here
</script>
-----------------------------------------------
Note that in both the code snippets, the variable strName has been
declared & assigned a value outside any sub-routine.
The first code snippet works fine but the second code snippet
generates the following error:
**********************
Request is not available in this context.
**********************
pointing to the Dim strName... line. Can someone please explain me why
does the second code snippet generate the above error & why does the
first code snippet work fine?
Thanks.........