Avatar of Mazzarino
Mazzarino

asked on 

Moving code to App_Code

In a web application I have a page Page21.aspx which has code associated with it in Page21.aspx.vb. This code works fine so long a it is on Page21.aspx.vb.

I need to put in similar pages Page22.aspx, Page23.aspx etc. Rather than copy all the vba each time, I modified the code on Page21.aspx.vb to call up the common vba routines which I have now placed in App_Code.

Now I see some problems. In particular the system does not like "cache". I often use instructions like cache("jobbo")=nr to pass number from one part of the code to another. While this was OK on Page21.aspx.vb, it seems to think that cache is somehow ambiguous when in App_code:

Error      17      'Cache' is ambiguous, imported from the namespaces or types 'System.Web.HttpContext, System.Web.HttpResponse'.

The second immediate problem is that response.redirect("PageG300.aspx") shows response as "non-shared member requires an object reference". Why ? And what reference should I give ?

There is something about App_Code that I have missed. I seem as though I haven't declared something, but I don't understand what, and I'm not sure where to look.
.NET ProgrammingMicrosoft Development

Avatar of undefined
Last Comment
kaufmed
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
.NET Programming
.NET Programming

The .NET Framework is not specific to any one programming language; rather, it includes a library of functions that allows developers to rapidly build applications. Several supported languages include C#, VB.NET, C++ or ASP.NET.

137K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo