I need to include a header and footer currently located in an asp page. The page takes the language ID and gives you the correct header for the page you are viewing.
I was going thru this: http://forums.asp.net/t/1420472.aspx and this particular fragment seemed to explain it better tho I could not wrap my mind around it.
Hi, instead of using include tags, you could compose your page this way:
Your .NET application here
You can
then implement in codebehind remote
header and footer download logic and
set them in the Literals’ Text. After
downloading from the remote site, I
would suggest to store the header and
footer in the application’s Cache to
avoid too many connections to the
remote server. If the same
header-and-footer are shared from many
pages in your project, moving this
structure to a MasterPage could be
useful.
Kindly assist.
Well, it would be applicable if header/footer content is coming from some other (remote) server. So the suggested solution is to
Now, this may or may not be applicable to your problem. From where does you get the content for header/footer. If its some helper class/method then you can directly call it to set the literal text. You can even do that is master page making things even simpler.
Edit: Additional information requested by OP
You can use WebRequest for downloading content. See this article to get started.: http://www.west-wind.com/presentations/dotnetwebrequest/dotnetwebrequest.htm
Refer below to get started on caching:
http://www.asp.net/general/videos/how-do-i-use-the-aspnet-cache-object-to-cache-application-information