Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / October 2007

Tip: Looking for answers? Try searching our database.

Request not available

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David C - 30 Oct 2007 20:49 GMT
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
Teemu Keiski - 30 Oct 2007 20:59 GMT
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

Signature

Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

>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:
[quoted text clipped - 15 lines]
>
> David
David C - 30 Oct 2007 21:07 GMT
Should I have it in the called page or in the page referred to in the
iframe?  Thanks.

David
> Hi,
>
[quoted text clipped - 30 lines]
>>
>> David
George Ter-Saakov - 30 Oct 2007 22:32 GMT
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.

>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:
[quoted text clipped - 15 lines]
>
> David
bruce barker - 30 Oct 2007 22:37 GMT
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").ToString

-- bruce (sqlwork.com)   

> 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:
[quoted text clipped - 15 lines]
>
> David

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.