Avatar of sqdperu
Flag for United States of America asked on

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?

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.

ASP.NETVisual Basic.NET

Avatar of undefined
Last Comment

8/22/2022 - Mon
Kyle Abrahams

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

Open in new window

Chinmay Patel

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


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

Ron Malmstead

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
David Johnson, CD

In the future when creating the project select empty project rather than winforms as per this video
Your help has saved me hundreds of hours of internet surfing.

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.