Solved

Moving code to App_Code

Posted on 2012-12-21
1
467 Views
Last Modified: 2012-12-25
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.
0
Comment
Question by:Mazzarino
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 38712864
it seems to think that cache is somehow ambiguous when in App_code:
Then simply fully-qualify your usages of the term "Cache" in your code.

e.g.

System.Web.HttpContext.cache("jobbo")=nr

Open in new window


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 ?
Same thing:  Fully qualify any references to that class.
0

Featured Post

The Orion Papers

Are you interested in becoming an AWS Certified Solutions Architect?

Discover a new interactive way of training for the exam.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

689 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question