Access Class File In Web Project?
Jan 29, 2010
I have a created a solution using visual studio 2008 and added a new project namely "test".
In this project i added a folder namely "code" and in this folder i added a class file "class1.vb".
But i am facinng problem when i am going to create object of that class1.vb in default.aspx.vb page
i want to access my class1.vb methods.
View 4 Replies
Similar Messages:
Oct 29, 2010
I am implementing a custom membership and role providers where I need to store all the role/membership information in the user's session.
I am implementing these custom providers inside a class library project (different from the website project) and need to access the session in them. The idea is to store the role/membership related information in the session after retrieving them for the first time from the database.
When I try to access the Session using System.Web.HttpContext.Current.Session
I get this as a null object (Object reference not set to an instance of an object.
Why is the session turning out to be null?
View 1 Replies
Jul 25, 2010
My project is completely built on asp.net with codebehind vb.net, is it possible to add a class library .cs file to my project. since it is based on c sharp will i be able to add it.
View 2 Replies
Jan 10, 2011
I have a custom gridview control which is a class library project.I want to be able to specify the css class for the gridview which I can do.But I also want to set a default css stylesheet to the gridview. So if I don't override it using the cssclass property it must get it's cssclass from the default stylesheet I have in my project.
How can I specify the default stylesheet. I have a stylesheet in a folder called "Styles" in my project.
View 4 Replies
May 23, 2010
Best way to describe my issue with vs 2010.create a new website. create the App_Code folder. create a new class in the folder. put the line "x" in the class declaration. hit compile. And the website will compile with no errors. It's not "seeing" this new class as being part of the project best I can tell.
View 1 Replies
Apr 2, 2010
I am using VB.Net/ASP.Net 2008 and I have a solution with 3 projects:
1. DAL
2. BLL
3. MainWebProject
anyways because it's a Web Application Project (not a web project) I had to set it up so I could access the Profile using Imports System.Web.Profile in the MainWebProj but I can only access the profile in that project.
anyways I need to access the Profile in the DAL also, and I figure since I can import the Profile in my MainWebProj there must be a way to also import that into the sister project, DAL.
My Issue: I can import a class in Project A but not Project B. Is there import syntax so I can also import the namespace in Proj B?
View 1 Replies
Jan 8, 2010
i'm trying an example by trying to creating two projects in one solution to seperate logic and UI. so let's say test.logic and test.ui
in test.ui i have a page called lets say contact me. in the code behind for this page i want to call a method that belongs in a class called processData in test.logic
in contact me cs i tried something like:
namespace test.ui
{
using test.logic
//code here
}
but that does not work as class/method not shown in intellisense.
View 5 Replies
Apr 12, 2010
I am trying to deploy my C# based ASP.Net 3.5 webapp
The hosting service provider said "Access 2003 (.mdb) file has to be put in 'access_db' folder in root folder"
I am currently using
OleDbConnection myConn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath("~/access_db/filename.mdb"));
The folder structure is like
ParentFolder/access_db/filename.mdb
ParentFolder/ProjectFolder/<Project files> (App_Data, bin, *.aspx, web.config)
1) I am using a GridView on another page that doesn't allow to connect to a database outside the project folder. What should I do?
2) How do I modify the programmatic connection string ( shown above) ?
View 11 Replies
Mar 9, 2010
I have an ASP.Net website, "MyApp", which contains the following resources files:
WebResources.resx
WebResources.es.resx
The website references a library project, "MyLib" from which I want to access those resources files. Here is the code I'm attempting:
var rm = new ResourceManager("MyApp", Assembly.GetExecutingAssembly());
subject = rm.GetString("HelloMessage"); //always string.empty
The problem is that the executing assembly is always "MyLib" instead of "MyApp". Is it possible to access the resource files embedded in the website project from a library project?
View 1 Replies
Mar 15, 2011
recommend a data access class / helper class for Access databases, similar to the sqlhelper class found in the (Data Access Application Block)?
View 6 Replies
Jan 24, 2010
I've an XML file stored in App_Data which is only used to read some configuration on startup. When I attempt to open it within my code, I get an Access to the path ... is denied message.
I'm having trouble understanding why, and how to solve it. I guess in theory I should alter the permissions on the file (and directory), but this hasn't changed anything.
To give a bit more background:1. Its a file bundled with the project, so the setup created by VS2008 writes it to the correct place during install. I didn't think I'd need to do anything unusual post install such that the ASP.NET application would have access.
2. When I've tried publishing this locally, I've not had any problems. - This is only on a test Windows 2003 server.
3. I've ran a simple page to understand the effective user of IIS - It is NT AUTHORITYNETWORK SERVICE. I tried granting "Full Access" to this user to this file, and still it doesn't work.The code to open it is simple:
FileStream fs = new FileStream(Server.mapPath(s), FileMode.Open);
Where s is defined as '~/App_Data/myfile.xml
I've even copied and pasted the full path & filename (from the exception) and tried "dir" on it, and it is indeed present (to get around a typo for example).I've also tried running aspnet_regiis.exe /s
View 1 Replies
Apr 8, 2010
I want to access a usercontrol in my class file not in aspx.cs.i need to typecast it using ASP.usercontrol_ascx type but i cant access ASP namespace from my .cs file..how to typecast the usercontrol??
View 1 Replies
May 23, 2010
Using Visual Studio 2005
I have list of class files, when i try to run the class files, it showing error as
"a project with output type of class library cannot be started directly"
How to run the class file? How to create a dll file.
View 5 Replies
Jul 23, 2010
I have an ASP.NET web site project where I am using both VB.Net and C# class files. I have included separate sub folders in the App_Code directory for classes of each language.However, while I can successfully make use of a C# class in a VB class, I cannot do the opposite: use a a VB class in a C# class.
So, to illustrate, I might have two classes such as this:
Public Class VBTestClass
Public Sub New()
End Sub [code]....
I get an error that "the type or namespace "VBTestClass" could not be found". What am I missing here?
View 2 Replies
Aug 20, 2010
Since we can access the private data member of base class in the derived class with the help of friend function. How can we do the same in C# asp.net? I mean whats the alternative of friend function in C# asp.net
View 2 Replies
May 24, 2010
I have a class (name PageBase) that is inhariting System .Web.UI .Page and all my .aspx page behind classes are inhariting this class. This way I have put some common things in PageBase class.
For showing errors I want to put showMessage funtion in PageBase as well so that I may have not put it in every page and it will easy to manage this way.
Probem is that how PageBase class will access a control which is in aspx page in its child class (child class of PageBase) .
I dont want to pass control as argument to function in parent class, is ther any other way ?
View 7 Replies
May 10, 2010
i have an project with name called(dbservice layer) which is in path: d:webserviceDBService. here i have an webservice which connects to DB and returns an object of an class.
once i added an reference here i get an url:http://localhost:2371/Jobs.svc
now i have another project name (UILayer) whic is in path: E:SchoolUILayer i added an service reference here with url as http://localhost:2371/Jobs.svc but i get an messgae telling service is unable why is that happening.
if both my webserivce layer and ui layer are in same project. then i able to use the webserive in the ui layer. and get the required output
so i wanted to know is there any way we can acesss the webserive from one project to another project
View 1 Replies
Sep 15, 2010
Suppose we declare and define the variable in one class let say FirstClass and we want to use that variable in another class let say SecondClass which is outside of FirstClass .how to do this?
View 2 Replies
Jan 16, 2010
i have code in .cs class file
i need it in .vb
i used conversion tool for converting
but i feel its not proper as i am not able to reference it in my page
is there any other way
View 4 Replies
Mar 4, 2010
i have the project files which consist of some folders and some aspx and aspx.vb files.
I do not have any solution file or .sproj file in it.
so I need open a single file at a time and I can not debug the whole project or any single file also.
Do I have to generate a project file or solution file,
I just wanted to open the whole project file by opening a single file in VS 2008.
so that all the folder structure and the files I can view in solution explorer.
View 1 Replies
Nov 18, 2010
I have build a UserControl with separate code behind file.In that code behind file i have defined some public properties in the Partial class of user control that was automatically generated.Those properties will initialize some properties of controls that are used in the control.Now, in .aspx page i used this User Control and initialized the public properties through code behind of aspx page for dynamic contents.
View 6 Replies
Mar 26, 2011
I have created an App_Code folder in my MVC 2 project and added a C# Class to it. In my Controller I have added a using reference to the namespace my class is in so that i can create an instance. However when I run the project it says there is a build error and that the namespace could not be found or doesn't exist. I have added a namespace to the <pages><namespaces> part of the config file and that didn't fix it.
View 1 Replies
Mar 20, 2010
I have a bit of code I am reusing on a lot of my pages so decided to put this code into a Class and placed this class inside the App_Code directory. However when ever I try and create an instance of tis class so that I can use it's Methods etc I can't seem to get it to work, but if I create the class in the web root for the project it all wrks as expected.
View 12 Replies
Feb 19, 2011
I have a Web project in which I defined some methods to parse some webpages. I then save the retrieved data in a DB. Now I have run a lengthy operation(it may take 2 days) in which I continously parse webpage this way.
Can I use the webproject from a Windows project. If I try to add a refference to it it doesn't work. How should I do it? I have used until now an asp.net application, and done the calls to the parsing methods in the pageLoad event but after an hour or so the process stops.
View 1 Replies
Jun 14, 2010
how can I use this in class project c#
Server.HtmlEncode ?
View 1 Replies