469,578 Members | 1,843 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,578 developers. It's quick & easy.

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

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
Nov 18 '05 #1
7 1125
Hmm, with quick thought couldn't you create a virtual directory that points
to the UC location? Bit like explained in following article:

http://authors.aspalliance.com/jimro...rControls.aspx

Thanks,
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Kristoffer Arfvidson" <kr********@spamtrap.com> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
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

Nov 18 '05 #2
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

"Teemu Keiski" <jo****@aspalliance.com> skrev i meddelandet
news:OB**************@TK2MSFTNGP12.phx.gbl...
Hmm, with quick thought couldn't you create a virtual directory that points to the UC location? Bit like explained in following article:

http://authors.aspalliance.com/jimro...rControls.aspx

Thanks,
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist

"Kristoffer Arfvidson" <kr********@spamtrap.com> wrote in message
news:OS**************@TK2MSFTNGP10.phx.gbl...
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


Nov 18 '05 #3
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.
--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #4
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

"Shiv Kumar" <sh***@erolsnoooospaaaam.com> skrev i meddelandet
news:%2****************@TK2MSFTNGP10.phx.gbl...
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.
--
Shiv R. Kumar
http://www.matlus.com

Nov 18 '05 #5
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.
--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #6
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

"Shiv Kumar" <sh***@erolsnoooospaaaam.com> wrote in message
news:uO*************@tk2msftngp13.phx.gbl...
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.
--
Shiv R. Kumar
http://www.matlus.com

Nov 18 '05 #7
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.

--
Shiv R. Kumar
http://www.matlus.com
Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by guiromero | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.