|
| A portal like website |
 |
Fri, 21 Mar 2008 15:18:55 +000 |
Greetings.
We are currently developing a job portal in ASP.net 2.0 with SQL Server as
backend database. I would really appreciate if someone can comment on the
approach we have taken so far.
We have a master page with a single content place holder named
"content". All aspx pages of the website are inherited from a
basepage. In the basepage the OnLoad is overridden to load the content on the
page dynamically. A pageid is passed to database to retrieve all the controls
that needs to be displayed on the page. From database we get the path of the
control and the order in which the controls are to be rendered along with a
module id for each. The first control that usually gets rendered on the page
will be a layout control This control is just for rendering the place holders on
the page. for e.g. It can be a control with 3 place holders left, center and
right. This is basically about how the page works.
Now in each control, i.e ascx, the Onload is overridden again. This is similar
to the Onload of page. Only difference is, the module id is passed to database
to get the child controls.
Also, in database, for each control a place holder id is stored, which tells
where the control needs to be rendered on the page. Caching is added to all
pages.
Is this a good design, will there be any performance bottlenecks?
If the briefing is not clear, do let me know. I'll try to explain in more
detail. Thanks for your time, all replies are very much appreciated.
|
| Post Reply
|
| Re: A portal like website |
 |
Sat, 22 Mar 2008 11:05:34 +000 |
Hi, I'm currently in the same process of designing/architecturing a
"dymanic" kind of portal in asp.net. At the moment I'm still gathering
all requirements, reading about technologies, trying small things out while
updating and maintaining the old application.
But I do have some ideas of how to display the pages dynamic from information
stored in the DB. Actually, I tried to write an article about it on my blog,
have a look and see if it helps (I'm not much of a writer yet). Like I said, I'm
still reading a lot and learning new things every day, so I updated it by using
the asp.net provider model here.
In short, I store the page information in a DB, including name, a master page
and a content page. The two latest ones are strings with the path to the
corresponding objects.
When accessing the default.aspx page, you need to add the pageid in the
querystring (or name), retrieve the page information from the DB. Set the master
page to the page and load the content control in the contentplaceholder of the
master page.
For loading the controls... I was thinking of using WebParts which does it all
for you by default. All you have to do is have the content control set up with
WebPartZones. You can then dynamical add webparts (controls) to it and the
personalization saves it all in the DB without you needing to write 1 single
line of code. You do need to perform some url rewriting or overriding the
personalization provider because by default it saves all personalization on the
url, and with a dynamic portal, you only have 1 url (default.aspx).
Hope this gives you some ideas as well. Looking forward to discuss this more
:D
|
| Post Reply
|
| Re: A portal like website |
 |
Sat, 22 Mar 2008 18:20:33 +000 |
Basically you are trying to do what SharePoint does but without using SharePoint
?
|
| Post Reply
|
| Re: A portal like website |
 |
Sat, 22 Mar 2008 21:07:54 +000 |
Thanks for sharing your ideas. I read your article, its looking good. I guess we
both are on same path. Only difference i found so far is storing information
about master pages, we are not doing that right now. Maybe we have to add that
as well. I'm relatively new to .Net(3 months), not sure about how dynamic master
pages work. Is it in pages onload, a master page gets rendered? It must be
right. So, basically in a page's Onload, you will be adding a master page
dynamically? Guess I have to do some research on this, the way a page gets
constructed in asp.net.
We thought of using webparts. Since our deadlines are very short and I have no
experience with webparts, decided to go for standard user controls. Will there
be any performance impact if we use webparts? I guess a webpart will add a lot
of code to the page's life cycle right?
For URL rewriting, I tried urlrewriter, so far its working great. We might run
in to problems when we start using AJAX controls. So far its working perfect.
Scott has written an excellent article on url rewiting. I converted the sample
code he posted in vb to c# and used it in my project. The article can be found
here
http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-a
sp-net.aspx
This is the piece of code that does loading of controls on a page. We have
similar piece of code in a user controls code behind as well. It takes care of
loading controls within a control. A control can have n-levels of childs like a
tree. All the loading is handled in a basemodule class recursively.
List modules = Modules.GetModulesByPageID(PageID);
foreach (ObjModule module in modules)
{
IModule control = (IModule)LoadControl(module.ModuleURL);
ContentPlaceHolder contentPlaceHolder =
Functions.FindControl(Master.Controls, module.PlaceHolder);
if (contentPlaceHolder != null)
{
control.ModuleID = module.ModuleID;
contentPlaceHolder.Controls.Add((Control)control);
}
}
I'm running out of time, hoping to discuss more on this next time. All comments
are very much appreciated.
|
| Post Reply
|
| Re: A portal like website |
 |
Sat, 22 Mar 2008 22:29:04 +000 |
I'm not that deep into masters pages and themes etc either. just started on that
myself. but we will use it for allowing different lay-outs depending on the
logged on user. We probably link the master page and theme to a user or role and
get the information from that.
I get all information on the page_init event. This is necessary if you work with
web parts because the web part manager (placed in the master page) needs to be
initialized before the load event.
To add a Master page to your content page (this is the page that derives from a
master page and should be your default.aspx), just use following code:
this.MasterPageFile = "~/Masters/MyMasterPage.Master"
I don't think WebParts will slow down performance. After all, WebParts are just
normal (User)Controls, wrapped around a generic class to make it compatible with
the framework. And if you go for a "dynamic" portal, it's the way to
go. With WebParts, the framework does the loading of the controls and the
placing of it on the pages all for you. It also remembers everything for you
when you moving controls around, add new ones or remove others. So, it does
pretty much the same as what you write, only without writing 1 line of code :D
Yep, that articel is a good one. And it's getting pretty cool as well.
especially when you start understanding RexEx more and more. It's amasing what
you can get out of url rewriting.
|
| Post Reply
|
|
|