?
Solved

Start Asp.net application with Default.aspx?

Posted on 2011-10-25
19
Medium Priority
?
273 Views
Last Modified: 2012-05-12
I  was advice to start my application with Default.aspx and not the aspx page I created as starting page particularly if you are puttting an application in IIS.
From the Default page, he mentioned that put a redirect to the page that I created.
Is that a good practice? What may be the reason?

Please send example how that is done and best practice?
0
Comment
Question by:zachvaldez
  • 8
  • 7
  • 4
19 Comments
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37024510
I can't imagine why it would make a difference.  Just make sure your web site knows which page it is supposed to serve up if one isn't specified in the URL.  In IIS this is done in the site properties, on the Documents tab.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37025252
Yes its a good practice as it does not require you to make changes in IIS. If someone lands on your site without specifying the particular page that you are developing, default.aspx will make sure that they are redirected to the correct page. It is also a practice to make default.aspx your home page.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37025485
Sorry, I disagree.  It's completely unnecessary.  Why would a person be more inclined to type "default.aspx" versus "index.aspx" (or "index.asp", or "index.html", or "index.htm", etc)?

Moreover, IIS allows you (as I previously indicated) to specify what page you want to send people to by default, if they don't specify a page in their URL.  
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:zachvaldez
ID: 37026324
I have looked some sites and it is coded diffrently. What is the preferable code in case Im force to implement it?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37027530
>Why would a person be more inclined to type "default.aspx" versus "index.aspx" (or "index.asp", or "index.html", or "index.htm", etc)?

That is the point actually. User does not have to type default.aspx and it will be displayed by default if you do not have other pages like index.htm etc.

>Moreover, IIS allows you (as I previously indicated) to specify what page you want to send people to by default

That is, if you have access to IIS which you dont on a shared hosting.
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37027707
The OP asked if he needed to have a page called default.aspx as his home page, or put a placeholder page at default.aspx to redirect visitors to his site's home page and the answer is no to both.  Having default.aspx may be ideal, but it's hardly necessary and may not justify re-doing any work done so far.

I can't speak to your hosting scenario, never having used a host that wouldn't let me configure my own site.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37027737
>I can't speak to your hosting scenario, never having used a host that wouldn't let me configure my own site.

You mean your hosts allow you to access their IIS manager?

Following are the sentences with question marks in the original question

Is that a good practice? What may be the reason?

Please send example how that is done and best practice?
0
 

Author Comment

by:zachvaldez
ID: 37031077
Hi ,
  Will you be able to provide the start up code in the Default aspx for a redirection?

thanks
0
 
LVL 34

Expert Comment

by:Paul MacDonald
ID: 37031118
You could do something simple like a Response.Redirect to your other page.  

A better alternative might be to wire the default.aspx page up so it returns an HTTP code 301, telling people the page has been permanently moved.  In that case you just need a default.aspx that has this:
<%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://" & Request.ServerVariables("HTTP_HOST") & "TheNameOfTheOtherPage"
%>
0
 

Author Comment

by:zachvaldez
ID: 37032938
whats the javscript equivalent of this code?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37032948
Window.location = "new address";
0
 

Author Comment

by:zachvaldez
ID: 37033036
>>>Window.location = "new address";

where will this be placed?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37033506
Put it in body tag

<body onload="window.location='sdssdfsdfsdf'">
0
 

Author Comment

by:zachvaldez
ID: 37035838
Is it possible to see this in Javascript

>><%@ Language=VBScript %>
<%
Response.Status="301 Moved Permanently"
Response.AddHeader "Location", "http://" & Request.ServerVariables("HTTP_HOST") & "TheNameOfTheOtherPage"
%>
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37036151
No. That is asp code. Now that code appears to be classic asp but paulmacd has suggested to put it in default.aspx.
0
 

Author Comment

by:zachvaldez
ID: 37038626
can't use it then
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37038653
You can but i would use the javascript if i was you.
0
 

Author Comment

by:zachvaldez
ID: 37074664
what is the javascript equivalent
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1000 total points
ID: 37078699
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question