.net - Using A Class Defined In App_Code In Web.config
Sep 6, 2011I have a class named CustomWebAuditEvent defined in App_Code/CustomWebAuditEvent.vb and I'm trying to use it in a eventMappings of my Web.Config
[Code]...
I have a class named CustomWebAuditEvent defined in App_Code/CustomWebAuditEvent.vb and I'm trying to use it in a eventMappings of my Web.Config
[Code]...
I have a very simple class that is located within my App_Code folder in my VS2008 web application project. I am trying to instantiate an instance of this class from my code-behind file. Intellisense does not seem to be seeing my class and I am not sure why. I am using VB.NET which I am admittedly not that familiar with as compared to C#. Perhaps I am missing something. I would bet it has something to do with something I am missing in VB.NET.Here is my simple class (for testing):
[Code]...
I have some common code that I would like to share between pages and I have been messing around with App_Code classes which is great but I would also like to use code that affects drop down lists example:
Sub Set_FirmType(ByVal Sender As Object, ByVal E As EventArgs)
subcategories.Visible = "false"
supplycategories.Visible = "false"
[code]....
Is their a way to put this in my App_Code class?
I have a class library (Named ADI), that needs some configuration settings from the project using it (like connectionstring, filesystem locations etc).
I want to define these settings in my Windows Forms/Web Projects App.Config or Web.Config, like other settings.
Here is part of my app.config for my windows forms application:
<applicationSettings>
<PhotoImportRobot.My.MySettings>
<setting name="ADIImageRoot" serializeAs="String">
[Code]....
Our main application has both a asp.net and winforms component. There is a class that is used by both sides and needs info from either the web.config or app.config files. The class itself does not know if it's on the client side or on the web server (at this point). We are getting errors when it's attempting read app.config when it's on the web side. Is there a way for the class to tell if it needs to read web.config or app.config?
View 1 RepliesI was dangerously close to high-jacking another thread, so I thought I should create my own. We make class libraries so we won't duplicate code, but what about settings? I have a large solution that I've created a project in for common material, which includes an app.config. The problem is that a class library isn't an "app" so my functions can't get to the values. How do I get around this?
View 20 RepliesI have been looking at some sample code, which includes the following line
Dim rule As FileSystemAccessRule = CType(Me.ACEDetails.SelectedNode.Tag, FileSystemAccessRule)
I'm a bit confused, because filesystemaccessrule has not been defined as a class anywhere in the code.
I have written a vb.net class library that pulls the url for a web service out of my.settings. However, at runtime it no longer bothers to read the class.dll.config file that it made.I want to deploy this dll in different environments and be able to custom choose the relative webservice via the class.dll.config file.
View 3 RepliesGot a solution with 3 projects, a Web Service, a WinForms (MyUI), and a Class Library (Foo).
MyUI calls methods in the DLL that access the web service. The DLL has project config settings that store the URL of the web service. I compile the solution and it compiles all 3 projects. In the DLL's bin dir it puts the foo.dll and foo.dll.config files. However, in the WinForms bin dir it puts the MyUI.exe, MyUI.exe.config, and foo.dll; it doesn't include the foo.dll.config. When I run the MyUI.exe from its bin dir, it appears to work, and is obviously getting the config settings from somewhere because it doesn't crash and successfully contacts the web service. However, if I copy the foo.dll.config file into the MyUI's bin dir, and change config settings and re-run, it appears to ignore my changes completely.
In the Class Library I setup the config settings through the project properties dialog under the Settings tab. I access them from code using My.Settings.
How do I modify the config settings post-compile?
I have a web site project where I need to use the System.Security.Cryptography.Xml.SignedXml class. I added the Dll System.Security as a reference and imported the namespace into my project. It compiles successfully but when I debug the project I get a compilation error:
Compiler Error Message: BC30002: Type 'System.Security.Cryptography.Xml.SignedXml' is not defined.
What gives? Edit: I run Windows XP Pro 64bit OS
BitmapPalette class is not defined in VB (express). What should I do ? Add a reference (which one) ? Declare myself the class in my project but that won't be the common class ?
View 4 RepliesHow do I set a property from within the class it is defined in?
View 2 RepliesI have been having some trouble today with a User-Control of mine. Is what is happening is when I try to build an application with the control in it, the Form.Designer has an Error saying that Namespace.ControlClass is not defined. I have no idea what the problem might be and hope that one of you do.The weird thing is that the Control Builds just fine and I can drag it from toolbox to the form and THAT works. Also, it works just fine in Design-time. It didn't start erroring until either, I upgraded it to VS2010 or until I changed it a bit today. If necessary, I can post it here.
View 2 RepliesSay I have a Class Library project with its own .dll.config, and a forms application. I want to confirm that it is impossible to reference the .dll.config file from the .exe.config file and still use My.Settings.
For example: I have SomeClassLibrary project, with SomeSetting that I can access through My.Settings.SomeSetting. I also have SomeFormsApp project. This is what I want my SomeFormsApp.exe.config to look like:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
[Code].....
From my readings, this seems impossible. I either need to copy the content of SomeClassLibrary.dll.config into SomeFormsApp.exe.config, which is tedious and error prone when copying from multiple class libraries, or I need to use ConfigurationManager, which bypasses My.Settings and its typed, Intellisensed goodness.
I'm having trouble with my application settings and I'm wondering if anyone else has seen this.
I have a Librabry with a connection string. In the project for the library it has its own app.config:
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="OBInfrastructure.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
[Code]...
I have a Class Library project with a appSettings.config file included into the project. The file is not embedded. So I have a ClassLibrary.dll with a appSettings.config beside in the bin.I have another project which is a Web Service. It has a reference on ClassLibrary.dll with a Copy Local=true. When I build the Web Service, the ClassLibrary.dll is brought into the bin of the Web Service. However, the .config doesn't follow.Do I need to do some postbuild event to copy the .config file or there is another setting I can set?
View 3 RepliesI have created a class that contains a property array, but I cant use the setters and getters.
[Code]...
I would like to make a "deep copy" of a class object that I have defined. See Visual Basic 2005 Code below
Dim MyStuff1 as new MyClass
Dim MyStuff2 as new MyClass
mystuff1.getbyID(anID)
mystuff2 = mystuff1
Unfortunately the statement "mystuff2 = mystuff1" makes a "shallow copy" of mystuff1. Therefore, if mystuff1 is redefined then so is mystuff2. What do I have to do in MyClass to implement a deep copy method such that operations on mystuff1 and mystuff2 are independent?I would prefer something like
mystuff1.deepcopy(mystuff2)
or
mystuff2 = mystuff1.deepcopy()
I have a small problem, classes and threading with classes. The problem I have is a dynamic array variable defined in class. In the code below, when error pauses the code, I can see the data in the correct form but I can't write rigth code that writes the data to richtextbox.
Public Class Form1
Public k() As Integer
Private Class zaratma
[CODE]....
First I put it inside a Module and it works just fine. However when I created a Class and put it inside it, it showed up some errors. (they are in the code's comments)
Public Class MyImageClass
'function to merge 2 images into one
Public Function Merge(ByVal img1 As Image, ByVal img2 As Image) As Image 'Type 'Image' is not defined
Dim bmp As New Bitmap(Math.Max(img1.Width, img2.Width), img1.Height + img2.Height) 'Type 'Bitmap' is not defined
[Code] .....
I tried importing the System.Drawing namespace to this class which didn't change anything either. I've never really touched the OOP side of VB.NET before, this is my first attempt creating a class.
I was knowing that For Each loop can only be applied to those classes that implement IEnumerable interface . But recently i accidentally wrote a code that is using For Each on my class's objects collection and my that class is not implementing IEnumerable interface .Below is the sample code that i am testing on :
Sub Main()
Dim personList() As Person = New Person(2) {}
personList(0) = New Person("s1", "s2")
[code].....
Suppose I want to build a class like
Class MyClass inherit Something
Dim A as string Bim B as integer
End Class When I am writing code, and i want to use thesenew properties or fields, the intellisense shows me the new properties and fields mixed with those inherited. Is there a way to show them all grouped togheter separated from those inherited ( a part giving them a common prefix in the name)?
I am in the process of migrating from VB6 to VB 2008. In a pixel grid system I have thousands of cells with about 15 properties each. In VB6 I employed the user-defined datatype "udtCell()" as my array structure. Is this still a good approach - or should I perhaps make Cell a class?
View 2 RepliesI am trying to access appSettings using the following syntax and I have used it before in my many website projects but not in a class library project. In this class library project I cannot even access the AppSettings Keys. Is there any way I could access the AppSettings Key from my class? Is the class library project's app.config or project structure behave in a different way?
[Code]...
I have already added Project Reference to System.Configuration and imported in my class. When I run my code it says, "Object not set to an instance of any object".
This is a Library code I got from Microsoft for format a textbox into a numeric format...but it's doesn't works because error message "numberFormatInfo is not defined".
Public Class NumericTextBox
Inherits TextBox
Private SpaceOK As Boolean = False
' Restricts the entry of characters to digits (including hex),
' the negative sign, the e decimal point, and editing keystrokes (backspace).
[Code] .....
Sometimes in my web applications I used to get this sort of error, I have no clue why is it coming however if I refresh the page few times the page is loading normally.I am using .net framework 2.0 and visual web developer 2005.
View 1 RepliesIn a number of my projects, I find myself declaring a rather boring class:
[Code]...
to e.g. allow an object to give information to another object in such a way that the information can be mutated later wherever it goes. For example, in a Dictionary(Of String, Holder(Of SomeImmutableType)) it's possible to update the thing of SomeImmutableType without having to change the Dictionary itself (since the Dictionary's entry for a given key will always contain the same Holder object, that Holder object may be used as a lock).
[Code]...
I have method that exisit in APP_CODE class and I want to call it from Class Library what is the best way to do that?
View 1 RepliesWhile 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?
View 1 RepliesThe below function has to be put within my common functions file in app_code folder. how do I do it?It gives error like this:Reference to a non-shared member requires an object reference
Public Sub setHeadTags(ByVal title As String, ByVal description As String, ByVal keywords As String)
Dim metaDescription As HtmlMeta = DirectCast(Page.Master.FindControl("metaDescription"),
[code].....