MVC :: Adding References To Custom Dlls In My Bin Folder In A Controller Class
Jul 28, 2010
I am having problems adding a reference to a custom assembly in my Bin folder within a controller class I am writing. I can see the dlls in the Bin folder of my Solution file and when adding a new 'using' block to the top of code page, its not picking up any of my assemblies as I try to spell them out.I tried just typing them in and building the solution, but I get errors, it just wont pick these up!
I've got an ASP.net project with a folder containing some dll's. I have referenced the DLL's from the folder.
I've modified one of the DLL's (Added a new class). I get build errors saying that the new class does not exist. When I add the reference the build errors go away in the Error List window. However, When I build the project the errors come back again.
I've set up a test project and referenced the DLL's and can access the new class with no problems so I know the class exists in the dll.
Currently Tearing my hair out!
EDIT: Forgot to mention I've also checked the refresh files and they seem to be pointing to the correct location
The type or namespace name 'DocumentFormat' could not be found (are you missing a using directive or an assembly reference?)' errors even though the dll is on both machines and references are in the two relevant projects. The errors are only coming up in one project in the (web) application and the app is building as expected on my machine.
I built a base controller class inherits from Controller class to add some custom behavior to all controllers which will inherit from this base class.
My issue is when I try to access HTTPContext and Session objects in my custom base class, they are always null.
Am I doing something wrong or need missing something?
My custom base class definition:
public class ApplicationControllerBase : Controller
controllers classes definition:
public class HomeController : ApplicationControllerBase
using ASP.NET MVC 1, .NET 3.5.
UPDATE:
It seems the issue is I try to access HTTPContext in the constructor while HTTPContext is not ready yet, I tried it in the OnActionExecuted event handler and it works fine.
My question is what is the best place to access Session object in my custom controller class, that will guarantee executing my code with all controllers.
I wrote a web project in VS 2005 using the AJAX Control Toolkit, now I'm resuming this project in a new machine and some AJAX components such as Cascade drop down doesn't works in none page.if I start a new project it works fine, so i think the problem is in the project I wrote years ago. when I try to include new ajax components I get an error message like "Attemted to read or write protected memory. this is often an indication that other memory is corrupt." and in the status bar keep saying, "adding reference to 'AjaxControlToolkit.dll'..."
I noticed that the DLLs in the bin folder for asp.net websites do not seem to be getting saved. When I goto a new computer and get latest I am missing the DLLs.What is the correct way to fix this ? Should I create a seperate folder to contains all DLLs ? And then can I somehow tell my bin references to goto that folder to get the DLLs?
my MVC2 delete and only my delete controller is refusing to return any class information. Its really similar to my edit function and the views are all auto-generated so I don't see the problem.
Function Delete(ByVal id As Integer) As ActionResult
I just downloaded entLib 4.1. Part of the download process included a DOS bat file that ran for a while. Being completely new to the Enterprist Library I have no idea how to use the Enterprise Library. Online support mentions something about accessing the blocks through the References folder in the Solution Explorer - but I don't have one in my solution explorer. How do I get the References folder to appear so that I can start figuring out how to use the application blocks?
I have a new blogengine site up and want to set up syntax highlighting. The problem is that I have a few files (javascript and css) that I need to add the the head of the page, but there is no one page or masterpage. where to write out these references so they will show up on all pages?
I have a vb.net class with properties defined as follows:
Private m_Property1 As String Public Property Property1() As String Get Return m_Property1 End Get Set(ByVal value As String) If IsNothing(value) Then m_Property1 = String.Empty Else m_Property1 = value End If End Set End Property
I can then set the values as follows:
classname.Property1 = "myvalue"
How do I set the value of a property that is defined dynmically eg
I have a separate environment for development. On my production server, where we mostly host web applications, we deploy the precompiled version of the web project. While doing development I work on three projects. One is the WCF Service. Two, is the class library project. This library has classes which makes calls on the WCF service. And the third, is a web project which consumes the class library.
The last two projects come under one VS solution. I host the wcf service in the development environment. This service is added as service reference to my class library. I am unable to visualize what will happen once I add the DLL (viz output of the class library project) to my web project, and, the web project has to be deployed. At the time of deployment I have to change the service reference (the url of the svc file will change as it has to point to the production wcf service). How to go about this? What must I take care when adding the dll to the web project?
In reconfiguring my site, I have deleted a few class files that are no longer needed. Upon deletion, intellisense is showing an error:
Error 8 Type 'Class1' is not defined. C:WindowsMicrosoft.NETFrameworkv2.0.50727Temporary ASP.NET Filesandersonwoodcrafts.com7a5f45392b25e40Sources_App_Codeprofile.cdcab7d2.vb 42 56 C:...andersonwoodcrafts.com
I have attempted to delete these manually from the file system, but it didn't correct this error.
How can I add a sub folder within the Views folder for a controller?
I have a controller named "admin". In the Views folder, there is an "admin" folder.
The admin controller has a number of actions. For each group of actions, there is a partial class that contains the actions of the group. admin/reports, admin/inventory, admin/orders, ... Problem is, when I move the "ReportsIndex.aspx" view into folder Views/Admin/Reports, MVC says it cant find the view when the ReportsIndex action method does a "return View("ReportsIndex", model) ;".
I am creating a custom control and had a thought before I began. My control relies on the jQuery library to work. What if the user already has a version of the library already on their page. Will this effect anything? If my version is newer / older and my control will only work with that version of the libaray, what should I do?
I am using Reporting Services to render a report directly to PDF. It requires that I use two web references: ReportExecution2005.asmx and ReportService2005.asmx. The performance on web references seems really poor. Since my web server (IIS7) and my SQL Server (2008) are on the same box, is there a way I can reference them directly? If not is there any way I can explicitly cache them or something. First load is really really slow, second load is perfectly acceptable.
I'd like to inherit all my controllers from a custom base class that I write myself. I can change the line every time I add a new controller, but it would be nicer if I could somewhere specify the default value that gets set there. That way I wouldn't need to worry about forgetting this, and other people who get added to the project later on would have an easier time.