We help IT Professionals succeed at work.

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 asked
on
114 Views
1 Endorsement
Last Modified: 2018-09-21
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

Kyle AbrahamsSenior .Net Developer
CERTIFIED EXPERT

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
CERTIFIED EXPERT
Distinguished Expert 2019

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
CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
David Johnson, CDSimple Geek from the '70s
CERTIFIED EXPERT
Distinguished Expert 2019

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

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.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.