Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Coding in C# and VB


Message #1 by "J Donahue" <jdonahue@f...> on Mon, 22 Apr 2002 19:00:11
Hello.  My Project Mgr (PM) is new to programming entirely and I'm new 
to .NET.  I'd prefer to code in C# but the PM wants to use VB.  I know it 
can be mixed somehow but I'm not sure how.
I know I can start a new project for C# code and simply make sure the URL 
is correct for each page (point to the correct directory) but I think 
this is inefficient.  I need to have the C# and VB items in the same 
directory.  How??
Also...I know Request.UrlReferrer will return the URL of the referring 
page (ie., http://localhost/mydir/mypage.aspx).  Is there a simple 
routine to give me the root URL (ie., http://localhost/mydir) or do I 
need to parse it out???
Thanks in advance!!!!!
Message #2 by Kevin Burton <kevin.burton@i...> on Mon, 22 Apr 2002 14:00:38 -0500
To mix VB and C# you will need to separate out projects based on assemblies.
I would recommend building a VB project that builds a VB assembly and a C#
project that builds a C# assembly. The two projects can be part of a single
solution in VS.NET for organizational purposes.

I am not sure what you mean by "simply make sure the URL is correct". As I
indicated about you can have a C# assembly and a VB assembly exist in the
same directory (I am assuming that you are using code-behind for you ASP.NET
application). Probably more secure would be to give these assemblies a
strong name and possibly put them in the global assembly cache (GAC). You
would need to evaluate your application to see if this is a good option.

As far as parsing URL's there is a URL class that you can use but more
useful is probably the URI class that can return various parts of the URI
with out the need to parse it specifically. If you don't like this class you
can always resort to the RegEx class and its associates which are equally
easy to use.

Hope this helps.

Kevin Burton
.NET Common Language Runtime Unleashed

-----Original Message-----
From: J Donahue [mailto:jdonahue@f...] 
Sent: Monday, April 22, 2002 2:00 PM
To: ASP+
Subject: [aspx] Coding in C# and VB

Hello.  My Project Mgr (PM) is new to programming entirely and I'm new 
to .NET.  I'd prefer to code in C# but the PM wants to use VB.  I know it 
can be mixed somehow but I'm not sure how.
I know I can start a new project for C# code and simply make sure the URL 
is correct for each page (point to the correct directory) but I think 
this is inefficient.  I need to have the C# and VB items in the same 
directory.  How??
Also...I know Request.UrlReferrer will return the URL of the referring 
page (ie., http://localhost/mydir/mypage.aspx).  Is there a simple 
routine to give me the root URL (ie., http://localhost/mydir) or do I 
need to parse it out???
Thanks in advance!!!!!

  Return to Index