app-code

Why I cant use Html.RenderPartial in razor helper view File in App_Code Folder?

孤者浪人 提交于 2020-01-23 05:49:04
问题 Simple Razor Helper in App_Code Folder: MyHelper.cshtml @using System.Web.Mvc @helper SimpleHelper(string inputFor){ <span>@inputFor</span> Html.RenderPartial("Partial"); } Simple View in Views/Shared Folder: MyView.cshtml <html> <head </head> <body> @WFRazorHelper.SimpleHelper("test") </body> </html> Simple Partial View in Views/Shared Folder: Partial.cshtml <h1>Me is Partial</h1> Compiler throws an Error: CS1061: 'System.Web.WebPages.Html.HtmlHelper' enthält keine Definition für

Catch exceptions in ASP.NET resulting from Generic Handler (ashx) file

被刻印的时光 ゝ 提交于 2020-01-10 04:36:05
问题 I am trying to get a different server side stack functioning with my ASP.NET site. My ashx file seems to be throwing a 500 Internal Server Error. How do I figure out what exception this ashx file is throwing or the reason the 500 is being thrown? When I attach to my IIS 7 w3wp.exe process, it doesn't throw an exception, but I'm reading that this is likely the case. The ashx file lives in the root directory of my ASP.NET site, and the Properties have it set to compile. GET http://uhc-8:8883

ASP.NET MVC using App_Code directory

我只是一个虾纸丫 提交于 2019-12-21 23:08:07
问题 I've added an App_Code directory to my ASP.NET MVC project so that I get dynamic compilation for plugins. Only slight annoyance is that when developing new plugins, I don't get intellisense on classes inside the App_Code directory. Currently I am creating them in another directory inside my project and then copying them into App_Code. is there any way around this? [Update] I've posted an "answer" below. Technically this answers the question as based on my own specification, the use of tools

ASP.Net - App_Data & App_Code folders?

有些话、适合烂在心里 提交于 2019-12-17 16:32:03
问题 What is the point of having App_code & App_data folders? Why doesn't my objectDataSource detect classes unless files are in App_Code? Please provide as much detail as you can, I'm new to ASP.Net 回答1: These folders have special purpose. From this article - ASP.NET Web project folder structure. App_Code App_Code contains source code for shared classes and business objects (for example, ..cs, and .vb files) that you want to compile as part of your application. In a dynamically compiled Web site

Copying/Moving App Code to New Project

纵然是瞬间 提交于 2019-12-12 02:24:27
问题 Ok, I am in the process of breaking apart of intranet application (VS 2010 Web Site, ASP.NET Web Forms with VB code behind). During this process i'm trying to convert some of our our app_code files in to WCF rest service in a new project. However, when I copy or "add existing" vb files into the new "services" project. I get tons of errors including... error BC30002: Type 'XXX' is not defined warning BC40056: Namespace or type specified in the Imports 'System.ServiceModel' doesn't contain any

Is it possible to add two language code files i.e. C# and VB.NET to App_Code? If so, how I could achieve this?

别来无恙 提交于 2019-12-10 20:58:28
问题 While adding two language code files i.e. C# and VB.NET to App_Code, got an error The files ... file names ... use a different language, which is not allowed since they need to be compiled together. Is there a way to add two different language files? 回答1: Create sub folders and put all your VB code in one folder and C# in the other. In your case you will have one for C# and the other one for VB You will need to modify web.config under the compilation element to include these so that the

Dynamic parameters for attributes

允我心安 提交于 2019-12-08 11:06:23
问题 I know parameters to attribute declarations have to be a constant expression and resolved at compile time. However, can I play with the concept of 'compile time'? ASP.net has the concept of App_Code folder. It looks from it's description like you can drop .cs files into it, even while the app is running, and it will be brought in and compiled. Is it possible to use this mechanism to dynamically create an Enum or const array that can be used in an attribute declaration? [SomeAttribute

Base class includes field but type not compatible with type of control

大憨熊 提交于 2019-12-06 18:29:49
问题 The base class includes the field 'lbl', but its type (web.App_Code.CustomLabelControl) is not compatible with the type of control (web.App_Code.CustomLabelControl). I had done many custom controls before the same way but Hell this error is driving me nuts. I have a web application project with the below class in App_Code directory a tagprefix reference in web.config for the control in class. What do I do now? Web.Config <system.web> <pages> <controls> <add namespace="web.App_Code" tagPrefix=

App_Code folder created automatically in published website

牧云@^-^@ 提交于 2019-12-05 22:47:15
问题 I have a MVC4 App created in VS 2010 with Umbraco 6 too and I've created a web deploy project which is used by my Team City CI server to deploy my website to a CI environment for testing. On the CI server the first time I load the homepage (or any page) it loads perfectly fine. However the act of loading a page creates a App_Code folder on my CI server, and after that I get the message "The directory '/App_Code/' is not allowed because the application is precompiled". Removing the App_Code

Base class includes field but type not compatible with type of control

好久不见. 提交于 2019-12-04 23:46:25
The base class includes the field 'lbl', but its type (web.App_Code.CustomLabelControl) is not compatible with the type of control (web.App_Code.CustomLabelControl). I had done many custom controls before the same way but Hell this error is driving me nuts. I have a web application project with the below class in App_Code directory a tagprefix reference in web.config for the control in class. What do I do now? Web.Config <system.web> <pages> <controls> <add namespace="web.App_Code" tagPrefix="CControls"/>... Markup <form id="form1" runat="server"> <div> <CControls:CustomLabelControl runat=