How can I access a UserControl that is located outside my application directory of my dll...?????

  • Thread starter Kristoffer Arfvidson
  • Start date
K

Kristoffer Arfvidson

HI!
I have a little question...
I need to access a usercontrol (*.ascx) file that is located outside my
application directory of my dll...

Heres my paths on my server:
wwwroot/
--------------
/index.aspx
/controls/menu.ascx

-------------------
wwwroot/members/
--------------
/index.aspx

---------------
ok, now, from the wwwroot/index.aspx i use the menu.ascx to show my menu...
ok.-..
From wwwroot/members/index.aspx , I also need to access this menu.ascx
control, because its the same menu...

Its two seperate dll´s...
and two seperate application´s... (wwwroot/ , and wwwroot/members/ )
(because I want to seperate the code more)...

How, Can I in VS.NET 2003 show both dlls under the same solution and, how
can I access the menu.ascx from my members dll ???

Appreciate quick response, thank you!

Yours: Kristoffer
 
K

Kristoffer Arfvidson

Thanks for your quick reply!
It is possible to do...
but it kind of isnt what I had in mind, because I really would need to se
code behind...
and also, I don´t want to bother my server provider with requests of making
a directory a virtual directory, even though I could...

Isn´t there any other way?

Yours: Kristoffer
 
S

Shiv Kumar

Basically, if you intend for multiple applications to access certain common
files then you should define a virtual folder for them. This virtual folder
does not need to be defined in IIS but is a virtual folder simply due to it
being a subfolder of the website's root folder (all depends on your
settings/configuration etc.).

There are various methods available to resolve relative urls in ASP.NET.
ResolveUrl comes to mind. Either ways, it is possible, but to keep things
simple, define a virtual folder under each of the websites in IIS and point
them to the same physical folder. I think it will avoid confusion in the
long run if this is how you intend to have your web applications designed.
 
K

Kristoffer Arfvidson

ok, so, is there maybe another way that is better, to when I design the
pages?
Maybe its better to just have one dll ???
The main reason for not having one is that it is alot of code in one dll,
and a lot of files to keep track of, since my webpage is basicly in two
parts...
one public and one private...

And, also, the problem for using just one dll is that I need to have my
members directory an application, path because of the
http://member.mysite.com url...
Hmm, anyways, Is there maybe another better way to design the pages ???

Yours: Kristoffer
 
S

Shiv Kumar

I wasn't really commenting on the page design or one/many dlls :)

I suggested using a virtual directory (configured in IIS) for all you
UserControls. This way all you applications can use this folder to get at
the UserControls. Similarly, when you need to update the UserControls you do
it in this one place.

You could have the code for the UserControls compiled into one or more
assemblies and have these assemblies registered with the GAC. Your
applications simply reference these assemblies.
 
W

Wolfgang Kaml

Shiv,

Can you please give an example of how a WebPage.aspx header has to look like
if it should reference a WebService or UserControl component that has been
registered in the GAC? - That would be great!

Thank!
Wolfgang
 
S

Shiv Kumar

You need to "add a reference" to the assemblies in your project.
Use the namespace

That's it.

It's no different from any other (Microsoft) assemblies you're already
using.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,077
Latest member
SangMoor21

Latest Threads

Top