ASP.NET / VB.NET - How do I clear out the Default.aspx file and have my form/page be the one that starts or have Default.aspx automatically call my page?

sqdperu
sqdperu used Ask the Experts™
on
My first ASP.NET Web Forms app.  VB.NET code behind (familiar with VB.NET)
I started my app and have it mostly done.   When I started I just made my own GFview.aspx form and put all my code in there.
I see when I created the app, it threw in it's own "Deafult.aspx" file with a bunch of MS links for ASP sites/info.

I want to clear all that mess out and have it be blank and automatically call my GFview.aspx page.

My questions:

If possible, I would like to put the code in the Default.aspx.vb file/code.  What code do I use?
Public Class _Default
    Inherits Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        '  ???   <== Here   ?

    End Sub

End Class

Open in new window


I have no idea what the URL would be of the page I want to call.
When I run it in design mode, the URL is this:  "http://localhost:52405/GFview.aspx"

I don't know much about web based functionality.

I guess the goal I am trying to acheive is removing the junk from the Default.aspx page and have my one page be that one that is used.  I hope that makes sense.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Kyle AbrahamsSenior .Net Developer

Commented:
in your web.config:
<system.webServer>
        <defaultDocument enabled="true">
            <files>
                <clear />
                <add value="MyPage.aspx"/>
            </files>
        </defaultDocument>
    </system.webServer>

Open in new window

Chinmay PatelChief Technology Ninja
Distinguished Expert 2018

Commented:
Hi sqdperu,

In addition to what Kyle has suggested,

Delete Default.aspx and rename your page from Solution Explorer(Not Windows Explorer) as Default.aspx

OR

You can also set it via Project Settings. Project Properties > Web > Specific Page > Set it to GFView.aspx

Regards,
Chinmay.
Information Services Manager
Commented:
...if I'm understanding correctly, you just want it to automatically go to the GFView.aspx page when you load the site base URL?

   Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

       Response.Redirect("~/GFView.aspx")

    End Sub

Open in new window


This will make Default.aspx redirect as soon as it's requested to the other page.
Top Expert 2016

Commented:
In the future when creating the project select empty project rather than winforms as per this video

Author

Commented:
Thanks everyone.   I went Ron's idea this time around.  It worked for this particular situation.   But I may try yours in the future.
I appreciate the help.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial