?
Solved

Moving code to App_Code

Posted on 2012-12-21
1
Medium Priority
?
476 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 1000 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

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…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
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…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

800 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