473,399 Members | 3,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,399 software developers and data experts.

Request not available

I have an aspx page that contains an iframe where I point to another aspx
page. In the aspx page that is in the iframe, I have VB code as follows:

<script language="vb" runat="server">

Dim strFolder As String = Request.QueryString("fldr").ToString

Dim PathVar As String = Server.MapPath("/wafgo/Pictures") & "\" & strFolder
& "\"

</script>

The Request.Querystring line is failing with the error Request is not
available in this context

I'm trying to pass the page a folder path and I don't know how else to do
it. I'm open to ideas. Thanks.

David
Oct 30 '07 #1
4 1434
Hi,

the code should be in any event of the Page. Like Init, Load or something.
Otherwise it gets executed "too early" during page lifecycle when certain
thuings aren't associated with the page, yet

Try

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles
MyBase.Load

Dim strFolder As String = Request.QueryString("fldr").ToString
....
End Sub
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"David C" <dl*****@lifetimeinc.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>I have an aspx page that contains an iframe where I point to another aspx
page. In the aspx page that is in the iframe, I have VB code as follows:

<script language="vb" runat="server">

Dim strFolder As String = Request.QueryString("fldr").ToString

Dim PathVar As String = Server.MapPath("/wafgo/Pictures") & "\" &
strFolder & "\"

</script>

The Request.Querystring line is failing with the error Request is not
available in this context

I'm trying to pass the page a folder path and I don't know how else to do
it. I'm open to ideas. Thanks.

David

Oct 30 '07 #2
Should I have it in the called page or in the page referred to in the
iframe? Thanks.

David
"Teemu Keiski" <jo****@aspalliance.comwrote in message
news:uH**************@TK2MSFTNGP06.phx.gbl...
Hi,

the code should be in any event of the Page. Like Init, Load or something.
Otherwise it gets executed "too early" during page lifecycle when certain
thuings aren't associated with the page, yet

Try

Protected Sub Page_Load(sender As Object, e As EventArgs) Handles
MyBase.Load

Dim strFolder As String = Request.QueryString("fldr").ToString
....
End Sub
--
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"David C" <dl*****@lifetimeinc.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>>I have an aspx page that contains an iframe where I point to another aspx
page. In the aspx page that is in the iframe, I have VB code as follows:

<script language="vb" runat="server">

Dim strFolder As String = Request.QueryString("fldr").ToString

Dim PathVar As String = Server.MapPath("/wafgo/Pictures") & "\" &
strFolder & "\"

</script>

The Request.Querystring line is failing with the error Request is not
available in this context

I'm trying to pass the page a folder path and I don't know how else to do
it. I'm open to ideas. Thanks.

David


Oct 30 '07 #3
This code
Dim strFolder As String = Request.QueryString("fldr").ToString
is executed during construction phase.

ASP.NET page did not get a chance to assign Request to the page.

George.
"David C" <dl*****@lifetimeinc.comwrote in message
news:%2***************@TK2MSFTNGP06.phx.gbl...
>I have an aspx page that contains an iframe where I point to another aspx
page. In the aspx page that is in the iframe, I have VB code as follows:

<script language="vb" runat="server">

Dim strFolder As String = Request.QueryString("fldr").ToString

Dim PathVar As String = Server.MapPath("/wafgo/Pictures") & "\" &
strFolder & "\"

</script>

The Request.Querystring line is failing with the error Request is not
available in this context

I'm trying to pass the page a folder path and I don't know how else to do
it. I'm open to ideas. Thanks.

David

Oct 30 '07 #4
request is a Page property, which can not be accessed by a class field
initialization expression, because the constructor has not been called.

class foo
dim strFolder as string = myProperty
...

try:

Dim strFolder As String =
HttpContext.Current.Request.QueryString("fldr").To String

-- bruce (sqlwork.com)

David C wrote:
I have an aspx page that contains an iframe where I point to another aspx
page. In the aspx page that is in the iframe, I have VB code as follows:

<script language="vb" runat="server">

Dim strFolder As String = Request.QueryString("fldr").ToString

Dim PathVar As String = Server.MapPath("/wafgo/Pictures") & "\" & strFolder
& "\"

</script>

The Request.Querystring line is failing with the error Request is not
available in this context

I'm trying to pass the page a folder path and I don't know how else to do
it. I'm open to ideas. Thanks.

David

Oct 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bhupesh Saini | last post by:
I am trying to call a ASPX page using HttpWebRequest class and pass cookie information to it. My ASPX pages gets called just fine, however none of the request cookies are available to the ASPX page....
1
by: Polaris | last post by:
Hi: I have some lengthy operations need to be finished before I can respond to client's request. Just wonder, is it possible to use a thread of my own to respond to client's web request? As a...
7
by: Shapiro | last post by:
I have a scenario where I log a resquest to a database table and update the request with a corresponding response including the response time. I am using an HttpModule to do this. My challenge...
3
by: ExclusiveResorts | last post by:
Can the CallContext be used reliably for storing request specific data? We are developing an application library that uses the CallContext to keep an IdentityMap (hashtable of business objects...
2
by: ruthiefy | last post by:
Hi, I created a class(AAA) which derives from System.Web.UI.Page. In the new class (AAA) I created some private variables and I initialize the variables from the property "Request". For some...
18
by: Thomas Lunsford | last post by:
I have inherited a set of asp pages that I now need to augment. In order to minimize changes to production code, I would like to make a "call" to an asp page from a new asp page. Existing code is...
10
by: sheldonlg | last post by:
I got an unusual request. One customer wants a password/access made available to a user that is valid for only, say, ten minutes. I know that I can enforce this by having a revalidation of the...
5
by: Rory Becker | last post by:
I have had code in my Application_Start which is intended to run once at the start of my application's life. It loads connection information and similar from a known location. However I...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.