Start Asp.net application with Default.aspx?

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?
zachvaldezAsked:
Who is Participating?
 
CodeCruiserCommented:
0
 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
CodeCruiserCommented:
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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
zachvaldezAuthor Commented:
I have looked some sites and it is coded diffrently. What is the preferable code in case Im force to implement it?
0
 
CodeCruiserCommented:
>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
 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
CodeCruiserCommented:
>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
 
zachvaldezAuthor Commented:
Hi ,
  Will you be able to provide the start up code in the Default aspx for a redirection?

thanks
0
 
Paul MacDonaldDirector, Information SystemsCommented:
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
 
zachvaldezAuthor Commented:
whats the javscript equivalent of this code?
0
 
CodeCruiserCommented:
Window.location = "new address";
0
 
zachvaldezAuthor Commented:
>>>Window.location = "new address";

where will this be placed?
0
 
CodeCruiserCommented:
Put it in body tag

<body onload="window.location='sdssdfsdfsdf'">
0
 
zachvaldezAuthor Commented:
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
 
CodeCruiserCommented:
No. That is asp code. Now that code appears to be classic asp but paulmacd has suggested to put it in default.aspx.
0
 
zachvaldezAuthor Commented:
can't use it then
0
 
CodeCruiserCommented:
You can but i would use the javascript if i was you.
0
 
zachvaldezAuthor Commented:
what is the javascript equivalent
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.