?
Solved

Set a default page in an asp.net application

Posted on 2004-11-30
12
Medium Priority
?
317 Views
Last Modified: 2010-04-23
Hi,

I have an intranet site and I want my users to be able to access my home page just by inserting the ip address of the server.

There is currently another web site like this in my company so I know this is possible. I just dont know how.

Your help would be much appreciated.

Thanks again

Paul G
0
Comment
Question by:pgilfeather
  • 3
  • 3
  • 3
  • +2
12 Comments
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12708125
You can use Server.Transfer

Keep in mind
Server.Transfer is overloaded. The overloaded version takes a second boolean
parameter indicating whether to stop processing of the current page. Pass
[true] to it to prevent this:

Server.Transfer("somepage.aspx or IP address", true);


You can enter the IP address or your web site to the text bos and then on the button click event

Server.Transfer(txt.Text, true)

0
 
LVL 4

Expert Comment

by:gdexter
ID: 12708190
Is the Home Page in a Virtual Directory of the Default Web Site?

If so you can use a redirection tag in the Default.htm page of the Default Web Site

<head>
<meta http-equiv="refresh" content="0; URL=MyHomePage.htm">
</head>

Renaming the Homepage to Default.htm or Default.aspx will give you  the results desired if your home page is in its own Web Site Directory
0
 

Author Comment

by:pgilfeather
ID: 12708227
Server.Transfer("somepage.aspx or IP address", true);

Is this the same in VB.NET?

Also where in my application would I put this code?

I want my user to be able to type directly into the address bar say.....if this was the server ip.....90.0.0.1 and this would take my user to the home page.

Cheers


Paul G
0
Technology Partners: 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:pgilfeather
ID: 12708264
So if you were in my company and you wanted to access my site home page all you would type in is 90.0.0.1 and you will always default to my home page.
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12708324
As I told you before
You can enter the IP address or your web site to the text box and then on the button click event put the Server.Tarnsfer

0
 

Author Comment

by:pgilfeather
ID: 12708376
No, no, you dont understand, this needs to be handled before the user even gets to the site never mind responding to a textbox event.

Suppose my home page url was....http://90.0.0.1/somefolder/homepage.aspx

I want my users to be able to type in http://90.0.0.1 and still get to my home page.

Hope this helps

Cheers

Paul
0
 
LVL 4

Assisted Solution

by:gdexter
gdexter earned 800 total points
ID: 12708473
In IIS the Default Web Site should have a Default.htm page
if it doesn't then create one.
This is the page that is shown when the IP or domain name is requested in the URL ie no virtual directoty in the path.

insert the meta tag into the head tag of that page.
<head>
<meta http-equiv="refresh" content="0; URL=somefolder/homepage.aspx">
</head>
0
 
LVL 28

Expert Comment

by:iboutchkine
ID: 12708506
Where do you want your user to type
 http://90.0.0.1?
0
 
LVL 16

Accepted Solution

by:
muzzy2003 earned 1200 total points
ID: 12708733
The list of candidate default pages in a folder is a simple thing to set in IIS. Look at the site properties, or the properties of any individual folder, in Internet Services Manager (IIS 5) or IIS Manager (IIS 6), and on the documents tab is a list of the documents that the server will attempt to run in order. Add your page at the top of this list and it'll be the default page.

It's nothing to do with ASP.NET, there's no need to play with redirects or anything like that. Don't ask me why Microsoft don't put default.aspx and other obvious ASP.NET choices on the list by default, but there you go ...
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12708814
Hello, McFly :)  Somebody's not paying attention to some pretty good advice.

Bob
0
 
LVL 4

Expert Comment

by:gdexter
ID: 12709029
muzzy2003

Curious, does this approach work when the document is not in the Server Root? As is the case with this question.
0
 
LVL 16

Expert Comment

by:muzzy2003
ID: 12709422
Yes, you can set a list of default pages on each directory. I don't know if they inherit from the root by default, I suspect so, but a quick test would tell you.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses

840 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