Share webpages between multiple websites (Best Way) - c#

I have created two websites using C# in Visual studio 2008. Both websites having common maintenance (User and Role) pages. I have also create a common class library (C#) and added reference to both website, which is working properly.
I don't want to replicate/maintain the multiple copies of the same aspx pages.
Is there any better way except user controls, to have single copy of common aspx pages and add reference to both website, just like class library?
Thanks.

In your response to Mr.Lister it sounds like you aren't using a master page, and your really should.

Related

Webforms in class library in asp.net

I am making a class library in asp.net , is there any possibility to add web forms in class library ( content view files with their code-behind ) so i can run , only with a simple method in the CALLER PROJECT ,a whole web app (thanks to this class library) .
I searched and i found i can't but If not , is there any near solution which can solve this problem ?
Thanks !
is there any possibility to make a class library as a web app "template" that we can use every time we call it in another project
A "class library" project, in Visual Studio terms, is strictly namespaces and classes - no web forms or controls allowed. And you're right, these projects are easily shared among sites by leaving them in a common source control repository or similar.
In an "ASP.NET Web Forms Web Application" project, you can reduce duplication by moving as much "code behind" code as possible to class libraries, which can then be shared among your team(s). You could even theoretically implement a lot of page/control functionality as "base classes" stored in class libraries and then inherited in aspx.cs and master.cs "code behind" files.
You could also move as much "code front" as possible into Custom User Controls which could be shared across projects by linking source control to a common repository.
But I don't think there's a good way to "share" .master and .aspx files. You could set up a basic website, keep it in a common place, and let people copy/paste it for new projects. But I don't know of a useful way to share that UI code among multiple web app projects.

Common ASPX pages used by multiple Application

Have a number of applications, which have similar pages.
E.g Payment Page, Search Page etc.
Looking for the best way to design the application so all the applications can use the common pages rather than having 3 versions of the same file.
It was suggested creating an app containing the common pages only where the other apps would transfer to when accessing the webpage and out again when finished. This just seems wrong, or am I incorrect.
Any advise appreciated.
ASPNET, c# framework 4.0
You'd need to override virtual path provider, which doesn't seem to be a trivial task..
Also there is a similar question - Share aspx page between projects (suggests to reuse at user controls level).

Implementing an html/css framework with a master page in visual studio

I'm working on a website for a school project and I designed it in photoshop with 9 columns.
To make life easier I want to use the 960 grid system (Custom for 9 columns) in order to build the design in html/css.
Part of the projects requirement is that I need to use a master page and web forms in c# however I'm not sure how to implement the 960 framework within that.
does anyone have any experience with this?
It sounds like you're being forced to use ASP.Net Web forms. I'd typically recommend you use ASP.Net MVC instead, and it does support Master pages, but really everything is a view, and I expect you would get push-back from the professor. So, to keep with the standard ASP.Net Web forms approach, you should create a new ASP.Net WebSite, and check off that you want a master page. Then Visual Studio will create the Master page for you, and any new aspx pages you create you can click a box to have them inherit from the master page.
If you look at the .Master page, you'll see the same HTML you would see on any site, including the , and tags. You should just include the .css file that contains your 960 framework file, just like you would on any Web page. Then the rest f the page will use the 960 grid, and you can put the necessary col# classes inside the class tag (or CssClass for ASP.Net controls) to get the display to work correctly.

How to Download Document from Sharepoint Librarly and display in ASP.NET programatically?

I have created a document library with name "ARTICLES" in SHAREPOINT which stores documents. Now, I want to display the documents in Repeater and clicking on row it must display the document. And also all documents must be Downloaded in Application folder.
The application is pure asp.net application using c# and not a webpart or other.
Help appreciated!
thanks!
Although it might not suit your application (and it isn't exactly what you asked for), there is a much easier way of achieving what you described (suited for intranet applications where Windows Authentication is used).
It involves two parts:
In your web application add a IFRAME that points to your SharePoint library (using the default SharePoint web interface).
[optional] Add a custom master page to this library so that you can hide menus etc.
For many applications this solution is sufficient and saves you lot of trouble of coding the integration (and retesting it with every SharePoint update) decoupling your application from SharePoint. It also makes sure that the end user can use all SharePoint functionality such as uploading the changes directly from Word etc.

Embedding page in sharepoint webpart

I need to create webpart in sharepoint 2010 which will allow me to view page from specific URL.
I.E. I'd like to view http://google.com from this webpart. What's the simpliest way to accomplish that ? I'm totally novice to Sharepoint developement, I've just downloaded SDK and watched some screencasts about creating webparts. Also I'd like to have few of this webparts on one page.
Maybe there is another and better way than creating a webpart ?
The easiest way is to use the Page Viewer Webpart. It embeds an IFRAME in the page, actually.
Maybe there is another and better way than showing external pages in an IFrame. Usually something like this will do:
This is not actually google, and eventhough we would love to actually be google
this link will have to do for now
Or if you are serious about displaying data from external partners, you should consider retrieving data through web-services.

Categories

Resources