Introduction
This article is to set the start page in windows and web application in dot net
Before we proceed I want to tell is that in Visual basic the way we set the startup page was very simple, when it comes to dot net it is far far different from the pervious approach.
In this article Iam exploring how to set the startup page for Windows Application and Web Application
Setting the startup page in Windows applications
There are three different way by which we can set the default page when we are developing a Desktop application using dot net.
Method 1. By default the first form you add will be the startup page for the application.
Here a question rises why so? Answer is that the editor will write the method main() in the form, which we add first.
So you should add that form, which you feel, would be the start up page. This may sound very odd and also it is. Proceed further you will find the ways by which we can change the settings of default page.
Method 2. Step 1.
Dot net Approach is that the form which have the main method() only those forms can be used as startup page, Please find the
Method below *************************************** static void Main() { Application.Run(new ()); } *************************************** One more point I like to specify is that all the forms in the project can have this method. So in other words Number of method main in a project, application can be Zero or maximum the no of forms we have in the project, application
Step 2.
A) Open the "Solution Explorer" B) Right click on the Project, then on the Property link at the bottom C) Project Property page will appear D) Open "Common Property" Link C) Click on "General" E) Click at the link "Startup Object" At right hand side F) This Combo will list all the Form, which have Method main() G) Select the Form, which you want to set as the startup form
Method 3. A) Open that form which has the method main() B) Change the class name after keyword new
Setting the Startup page in Web Application
When it comes to Web Application the best way to set the startup page
The process of setting the default pages in the web application is a very complicated issue as setting the web server, setting the property of application the defining the page for the same all is very Cumbersome So Iam using most easiest way to do this. As we all know that in a website the default page, Index page, Home page as the startup page until we don't remove this detail So Why not use the same approach A) Create the default page. B) In the default page add following ASP.NET code <% Response.Redirect(""); %> C) In the code above within double cotes you have to include the aspx file name, which you want to load as default page.
Dot Net Being a Object oriented this approach is best possible a class with the main method() is the only possible way to start
I wish this article would be useful for all my co-developer
|
No responses found. Be the first to respond and make money from revenue sharing program.
|