Link to home
Start Free TrialLog in
Avatar of sqdperu
sqdperuFlag 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.

Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

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

Open in new window

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

Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the future when creating the project select empty project rather than winforms as per this video
Avatar of sqdperu


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.