hey all,
im building a asp.net project in vs.net. Is there a way to have the
codebehind files sit in a different folder outside the website folder
altogether?
example:
The aspx files are in this directory
c:\inetput\wwwr oot\testapp
the code behind code must be in this directory
c:\projects\tes tapp\src\com\ti etronix\testapp \codebehind
where the namespace is "com.tietronix. testapp.codebeh ind"
I have tried these steps with no success.
1) changed the namespace in the aspx.cs file to the appropiate one.
2) changed the @page decl to
Page language="c#"
Codebehind="c:\ projects\testap p\src\com\tietr onix\testapp\co debehind\WebFor m
1.aspx.cs" AutoEventWireup ="false"
Inherits="com.t ietronix.virtua lastronaut.code behind.WebForm1 "
If this is possible outside of vs.net using a simple text editor - that
would be great as well.
Since im new to the namespace and codebehind concepts, id really appreciate
it if i could get a example that i was able to see.
thanks in advance for your help!
girish 5 1477
Hi,
You can certainly change the default namespace name to fit your needs. But
you can not change the location of the code behind file by modifying the
CodeBehind to includes the full path. This is the MSDN doc for CodeBehind
Attribute:
*************** *************** *************** *************** *************** *
*************** ***************
CodeBehind
Specifies the name of the compiled file that contains the class associated
with the page. This attribute is used by the Visual Studio .NET Web Forms
designer. It tells the designer where to find the page class so that the
designer can create an instance of it for you to work with at design time.
For example, if you create a Web Forms page in Visual Studio called
WebForm1, the designer will assign the Codebehind attribute the value of
WebForm1.aspx.v b, for Visual Basic, or WebForm1.aspx.c s, for C#. This
attribute is not used at run time.
*************** *************** *************** *************** *************** *
*************** *************** *
You should not keep aspx and codebehind source file in seprate folders.
Both of them are part of a page entity.
Jiange Sun
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.
Hi Girish,
Thanks for posting in the community! From your description, you'd like to
set the codebehind file and the aspx file in separate folders, also you're
wanting some information or guides on using the code-behind file when
developing ASP.NET web page.
As for the first question, I quite agree with Jiange's suggestion. Since
the codebehind file is generated for us help develop the web pages more
conveniently at design time, it's better to make them together within the
same location.
And I've searched some references and tech articles on the description and
how to use the "code-behind" mode to develop ASP.NET web pages with VS.NET,
you may have a check to see whether they're helpful to you. Here are the
web links to them:
#Web Forms Code Model http://msdn.microsoft.com/library/en...msCodeModel.as
p?frame=true
#Developing User Controls in a Code-Behind File http://msdn.microsoft.com/library/en...lopingusercont
rolsincode-behindfile.asp? frame=true
#INFO: ASP.NET Code-Behind Model Overview http://support.microsoft.com/default...b;en-us;303247
#HOW TO: Work with Code-Behind Class Files in an ASP.NET Application by
Using Visual C# .NET http://support.microsoft.com/default...b;en-us;308143
If you have any questions or need any further help, please feel free to
post here.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Thanks for the replies guys. I understand. Theres only one problem yet to be
ironed out in my mind. The code behind file is a class. Classes have
namespaces. For some reason I have a problem if I cant declare a class to be
in a namespace of my choice. I just cant seem to flush that from my system
that your not really supposed to do that.
If i want all source files to be in a namespace called
com.tietronix.t estapp, how would i do that for the codebehind since it does
*not* sit in a directory structure of the format /com/tietronix/testapp BUT
sits in the web directory which is c:\inetpub\wwwr oot\testweb
And thats another problem I have with VS.net. Why does it not allow me to
choose a directory on the local machine for my asp.net source files and on
build time - allow me to publish to a webserver? I want to isolate my source
files and my deployment files. Cause when you deploy, you dont need the
codebehind classes. you just need the assembly. I like to maintain this
directory structure since all my source files tend to sit in vss and src and
build files intermingling are just my pet peeves.
thanks. Im confused and I guess there is more than one q here.
If you cant answer them - thats ok. Everything slowly becomes clear anyways
after a few weeks of development. This is my first week of developing on the
..net platform.
thanks for your help.
girish
"Steven Cheng[MSFT]" <v-******@online.m icrosoft.com> wrote in message
news:gD******** ******@cpmsftng xa07.phx.gbl... Hi Girish,
Thanks for posting in the community! From your description, you'd like to set the codebehind file and the aspx file in separate folders, also you're wanting some information or guides on using the code-behind file when developing ASP.NET web page.
As for the first question, I quite agree with Jiange's suggestion. Since the codebehind file is generated for us help develop the web pages more conveniently at design time, it's better to make them together within the same location. And I've searched some references and tech articles on the description and how to use the "code-behind" mode to develop ASP.NET web pages with
VS.NET, you may have a check to see whether they're helpful to you. Here are the web links to them:
#Web Forms Code Model http://msdn.microsoft.com/library/en...msCodeModel.as p?frame=true
#Developing User Controls in a Code-Behind File http://msdn.microsoft.com/library/en...lopingusercont rolsincode-behindfile.asp? frame=true
#INFO: ASP.NET Code-Behind Model Overview http://support.microsoft.com/default...b;en-us;303247
#HOW TO: Work with Code-Behind Class Files in an ASP.NET Application by Using Visual C# .NET http://support.microsoft.com/default...b;en-us;308143
If you have any questions or need any further help, please feel free to post here. Regards,
Steven Cheng Microsoft Online Support
Get Secure! www.microsoft.com/security (This posting is provided "AS IS", with no warranties, and confers no rights.)
hmmmm
namespace has nothing to do with directory structure?
meaning if I had a namespace of com.tietronix.c odebehind, the file declared
of that namespace need not be in a folder called
......./com/tietronix/codebehind/ ?
thanks,
girish
"Jiange Sun [MSFT]" <ji*****@online .microsoft.com> wrote in message
news:Y4******** ******@cpmsftng xa07.phx.gbl... Hi,
You can certainly change the default namespace name to fit your needs. But you can not change the location of the code behind file by modifying the CodeBehind to includes the full path. This is the MSDN doc for CodeBehind Attribute:
*************** *************** *************** *************** *************** * *************** *************** CodeBehind Specifies the name of the compiled file that contains the class associated with the page. This attribute is used by the Visual Studio .NET Web Forms designer. It tells the designer where to find the page class so that the designer can create an instance of it for you to work with at design time. For example, if you create a Web Forms page in Visual Studio called WebForm1, the designer will assign the Codebehind attribute the value of WebForm1.aspx.v b, for Visual Basic, or WebForm1.aspx.c s, for C#. This attribute is not used at run time.
*************** *************** *************** *************** *************** * *************** *************** *
You should not keep aspx and codebehind source file in seprate folders. Both of them are part of a page entity.
Jiange Sun
Microsoft Developer Support
This posting is provided "AS IS" with no warranties, and confers no
rights. Please reply to newsgroups only.
Hi Girish,
Have you viewed my last reply or have you got any ideas on this problem?
Please check out my suggestions in the last reply. If you need any further
help, please feel free to let me know.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Joe |
last post by:
I made a template for webforms. The template.inf calls for two files the
..ascx and the .cs. The .cs template file's code does not get written out to
the newly added control?
Joe
|
by: edster |
last post by:
A *lot* of our teams code is being deleted from the
InitializeComponent() section of a winform, such as Grid settings,
event handler hooks, layout settings etc. This mainly seems to
happen to 3rd party controls such as Infragistics grids and menu bars
and toolbars, but it also happens on native .net tools.
I know you're thinking that I...
|
by: Brian W |
last post by:
Hi All,
I have a web user control that, among other things, provides Print this
page, and Email this page functionality I have this script that is to
execute on the click of the asp:hyperlinks
I have a function in a <SCRIPT> block that I want in the <head></head>
section of the page. Unfortunately, RegisterClientScriptBlock,...
|
by: Dan |
last post by:
We have a simple site. It's a frameset with two frames a left and a right.
The left frame is essentially a list of records from a database (using a
server-side repeater control). When you click on one of the items in the
left frame, it targets the right frame and displays a form prefilled with
information for the item you clicked.
The...
|
by: Don Munroe |
last post by:
This one has me stumped. I have three web applications running on two
different servers. The first that works fine is hosted by a .Net hosting
company. Everyone that uses it has no problems hitting the site. The other
two applications are running on my personal server which has Windows 2003,
IIS 6, and .Net 1.1
Most of my users can use...
| |
by: Don Munroe |
last post by:
This one has me stumped. I have three web applications running on two
different servers. The first that works fine is hosted by a .Net hosting
company. Everyone that uses it has no problems hitting the site. The other
two applications are running on my personal server which has Windows 2003,
IIS 6, and .Net 1.1
Most of my users can use...
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles) like it because you can
split the code from the design. That is logical. But if you are the only
one working on the code, it seem a little...
|
by: Sandy |
last post by:
Hello -
I am using Visual Studio .Net. I need an example of how to construct a
class that can be used throughout a project where I can include its subs and
functions in various pages in the project.
I googled this and either I didn't use the correct words, or there doesn't
seem to be much on it.
Any help will be appreciated!
|
by: Cheryl Langdon |
last post by:
Hello everyone,
This is my first attempt at getting help in this manner. Please
forgive me if this is an inappropriate request.
I suddenly find myself in urgent need of instruction on how to
communicate with a MySQL database table on a web server, from inside
of my company's Access-VBA application. I know VBA pretty well but
have never...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |