Geekzone: technology news, blogs, forums
Guest
Welcome Guest.
You haven't logged in yet. If you don't have an account you can register now.


8d52797c436

264 posts

Ultimate Geek
Inactive user


#46751 9-Nov-2009 13:09
Send private message

Hi All,

I'm having a bit of a problem with the web application I'm currently working on. In it there are a few Web User Controls that we use to display information on a bunch of different pages. They seem to compile alright and arent showing up any errors. The problem is trying to register them on other pages to access them is returning a 'file not found' error in visual studio (2005). I have them defined like this:

<%@ Register TagPrefix="cc2" TagName="ControlSelector" Src="~/components/controls/ControlSelector.ascx" %>

The strange thing is that when I remove the '~' from the front no error is shown but the path beomes ~//components/controls/ControlSelector.ascx when looking at the designer and obviously it cant find the control anyway.

I've spent nearly the whole morning trying to figure out the virtual path concepts but none of it seems to matter.

Create new topic
RedJungle
Phil Gale
1108 posts

Uber Geek

Trusted
Red Jungle
Subscriber

  #271280 9-Nov-2009 13:25
Send private message

I don't see any problem with your syntax.. if you 100% absolutely sure that "ControlSelector.ascx" is under ~/components/controls/ (with ~ meaning the root directory of course). Then some other things to potentially look at:

Be aware that @ Register declarations should come directly after the @ Page.
Are there other controls in the same directory? are they working?
Are there any potential directory permissing issues in this location?
Are you enforcing security on the website which disallows anonymous access to that directory? (this has caught be out more than once!)

Good luck. I'm sure it will be something really silly/simple in the end.




Red Jungle: we make fantastic software

RSS  Twitter  Facebook  Skype

8d52797c436

264 posts

Ultimate Geek
Inactive user


  #271297 9-Nov-2009 14:28
Send private message

Hi, thanks for the quick reply. I think the biggest problem here is that I have never really studied or worked on website pages in VB.Net before so there's quite a bit about this that I dont really understand. This stuff is all actually from a website that I have inherited for my job so most of it isnt stuff that I have written myself, and it seems almost a little too complicated to figure out without a background in this sort of thing.

All the controls are being called directly after the @ Control as these are all being called from .ascx files. Is that the same as the @ Page line you mentioned?

Registering the assembly for the project seems to work, but none of the registering to the files themselves are working.

I have checked the file permissions and it seems like there should be no permission issues with it. At least they are all being shared under the default website and anonymous access is allowed for the site.

I'm sure it will be just something small that I am missing. The strange thing is I have checked on a few of the pages that use the control, and while it says it cannot find the file specified it can still show the control in the designer for that page... It may be a severe case of Mondayitis but I'm completely stumped.

 
 
 
 


RedJungle
Phil Gale
1108 posts

Uber Geek

Trusted
Red Jungle
Subscriber

  #271302 9-Nov-2009 14:39
Send private message

Ah, I see - it appears you're trying to nest a user control inside another user control (.ascx) rather than inside an actual page (.aspx)? To be honest I'm not sure if this can be done - it's certainly something I'd try to avoid if at all possible. You should be embedding controls only within actual pages.

The quick fix would be simply to rearrange a few things so that user controls are called/embedded into pages rather than nested.

So if your currently doing this:

Page -> Control1 -> Control2

Then switch to

Page -> Control1
-> Control2

Or move the contents of Control2 into Control1.

Hope that makes sense?




Red Jungle: we make fantastic software

RSS  Twitter  Facebook  Skype

8d52797c436

264 posts

Ultimate Geek
Inactive user


  #271310 9-Nov-2009 15:04
Send private message

Ok thanks for the help. The problem I can see is that our site uses template pages for every page to get the menu and a few other things on there, and then we have subset controls for different things we want people to see and then sometimes, like with this selector control, we nest that inside the existing .ascx page. I have read an article on the MSDN online library which explains that it can be done and that it is fine to do so.

We have 3 copies of the site that we use. 1 is live, 1 is development, and 1 is a replica of the current live. I have been testing the control on all 3 and while it works on the development (even though VS says it cant find it) it doesnt work on the replica or the live site. I'm just going to have to keep playing around with it and figure out why it works on some controls and not others. Looks like fun times ahead.

nate
6405 posts

Uber Geek

Moderator
Trusted
Lifetime subscriber

  #271311 9-Nov-2009 15:10
Send private message

RedJungle: Ah, I see - it appears you're trying to nest a user control inside another user control (.ascx) rather than inside an actual page (.aspx)? To be honest I'm not sure if this can be done - it's certainly something I'd try to avoid if at all possible. You should be embedding controls only within actual pages.


It is doable and works - I have a couple of instances that have user controls embedded in user controls.

RedJungle
Phil Gale
1108 posts

Uber Geek

Trusted
Red Jungle
Subscriber

  #271314 9-Nov-2009 15:18
Send private message

8d52797c436:
We have 3 copies of the site that we use. 1 is live, 1 is development, and 1 is a replica of the current live. I have been testing the control on all 3 and while it works on the development (even though VS says it cant find it) it doesnt work on the replica or the live site. I'm just going to have to keep playing around with it and figure out why it works on some controls and not others. Looks like fun times ahead.


Okay, that's useful information. So the primary difference here will be the dev copy is running on the asp.net development server, where the live and replica will be IIS of some version?

Can you post the actual error message you're getting under IIS?

nate:
It is doable and works - I have a couple of instances that have user controls embedded in user controls.


I learn something new every day. In this case, that I should never get nate to design any of my architecture! :P But seriously, I guess I've never really had a need to arrange things in such a way - it strikes me as something that would be a messy/hard to manage practice long-term. But then as with everything, it will depend on circumstance.




Red Jungle: we make fantastic software

RSS  Twitter  Facebook  Skype

8d52797c436

264 posts

Ultimate Geek
Inactive user


  #271320 9-Nov-2009 15:34
Send private message

We actually run both replica and dev versions (both hosted locally) using IIS on our development machines. I have tried loading up the pages and it doesnt seem to be causing any sort of hassle IIS as no error messages are being shown, the control just isnt appearing. I think I may have to stay late tonight or come in early tomorrow to try and do a deployment to our live site so i can check to see if it works without risking downtime on the site during business hours.

It does seem like a very complicated way of doing things, especially for someone like myself who didnt study web applications or vb.net or anything of that nature at university haha

Create new topic




News »

Amazon introduces new Echo devices
Posted 25-Sep-2020 11:56


Mad Catz introduces new S.T.R.I.K.E. 13 Mechanical Gaming Keyboard
Posted 25-Sep-2020 11:34


Vodafone NZ upgrades international submarine network
Posted 25-Sep-2020 09:09


Jabra announces wireless noise-cancelling airbuds, upgrade existing model
Posted 24-Sep-2020 14:43


Nokia 3.4 to be available in New Zealand
Posted 24-Sep-2020 14:34


HP announces new HP ENVY laptops aimed at content creators
Posted 24-Sep-2020 14:02


Logitech introduce MX Anywhere 3
Posted 21-Sep-2020 21:17


Countdown unveils contactless shopping with new Scan&Go tech
Posted 21-Sep-2020 09:48


HP unveils new innovations for businesses adapting to rapidly evolving workstyles and workforces
Posted 17-Sep-2020 15:36


GoPro launches new HERO9 Black camera
Posted 17-Sep-2020 09:45


Telecommunications industry launches new 5G Facts website
Posted 17-Sep-2020 07:56


New Zealand ranks 3rd in world in GSMA index
Posted 15-Sep-2020 10:13


Trend Micro Security Suite adds web monitoring to prevent identity theft
Posted 14-Sep-2020 15:37


NVIDIA to acquire Arm for US$ 40 billion
Posted 14-Sep-2020 12:27


Epson launches its next gen A3+ colour EcoTank multi-function printer
Posted 10-Sep-2020 16:08



Geekzone Live »

Try automatic live updates from Geekzone directly in your browser, without refreshing the page, with Geekzone Live now.


Support Geekzone »

Our community of supporters help make Geekzone possible. Click the button below to join them.

Support Geezone on PressPatron



Are you subscribed to our RSS feed? You can download the latest headlines and summaries from our stories directly to your computer or smartphone by using a feed reader.

Alternatively, you can receive a daily email with Geekzone updates.