Try our conversational search powered by Generative AI!

How to set default page to an external .aspx page, in IIS outside of Episerver?

Vote:
 

Hi,

I have a WebForms Episerver installation. I'm trying to set the default page in IIS to be Default.aspx but it's not working. Whenever I browse http://localhost I get 404 error. When I browse http://localhost/Default.aspx it works. I do not want to set the startup page in Episerver and I don't have any websites configured on the admin tab within Episerver.

All my Episerver pages are working fine when I browse to them. Editing, logging in etc works fine. The only thing that's not working is the default page when I don't specify the file name. I do have DefaultDocument set up in IIS correctly but still get the 404 error. I tried commenting out the Global.asax contents but no joy.

Thanks!

#180031
Jun 28, 2017 18:21
Vote:
 

Hi,

Episerver hooks up quite alot to the routing part in .net. Browsing to "/" Generally means the Start Page in your page tree structure

Are the visitors ever browsing to the Start Page of your page tree structure?

If not, how about making your Default.aspx the template of the Start Page page type?

#180079
Jun 29, 2017 12:47
Vote:
 

Hi Alf,

First I should clarify that I am new to Episerver and I am working with a trial version. So I am just learning still.

There isn't a start page set in my page tree structure. When I tried to set a start page it messed up all the URLs. And then of course that page from the tree structure was the one to load, which I don't want. I want the Default.aspx page.

I don't think I can make my Default.aspx the template of anything since it doesn't have a page type (or whatever Episerver needs to "see" the template).

Isn't there a setting in the web.config or something to allow custom pages to be used?

Thanks!

#180090
Jun 29, 2017 15:55
Vote:
 

It sounds like you're trying to use Episerver in a way that it was not intended. You can usually use custom aspx.. But in this case it's the default "What do you get when browsing to /".

Generally an Episerver website needs a start page that is selected in the Websites settings in Admin Mode.

To get this workaround, you don't have to have a page type for the Default.aspx (you usually write Default : TemplatePage<StartPage>, try to just let Default.aspx inherit PageBase and it doesn't have to be connected to the StartPage page type.

Would that work?

#180091
Jun 29, 2017 16:01
Vote:
 

OK, I changed my Default.aspx.cs from:

Default : System.Web.UI.Page to Default : EPiServer.Core.PageData (PageBase did not work, it said no constructor takes 0 arguments)

I then rebuilt the solution but I still get a 404 when I try to load /.

#180092
Jun 29, 2017 16:11
Vote:
 

Ah, can you try SimplePage instead? Missed that Episerver had removed that constructor restraint since last time I used it.

Have you created a Start Page and in Admin mode created a website with your page as Start Page?

#180093
Jun 29, 2017 16:14
Vote:
 

No, I didn't. I would have to create a new page beause I don't want to use any of my existing pages. Does it matter what page type I use? I only have 3: one-column, two-column and event. (I picked one-column)

How do I prevent this new start page from showing in the menu?

How do I assign my Default.aspx to the start page? I don't want any content from this start page to actually display on the Default.aspx.

I need to step away for a couple hours, but I appreciate all of the help!

#180095
Jun 29, 2017 16:27
Vote:
 

You need to connect your page type to the .aspx, if you use your one-column, two-column or event that would mean that the other pages of those page types will start using Default.aspx. I guess you have already created .aspx files for them.

The content on your Start Page will not be displayed unless you start writing code such as <Episerver:Property runat="server" Propertyname="xxx" /> or <%= CurrentPage.MyPropert %> or similar.
The Start Page Page Type will only be used to make sure that browsing to "/" will load Default.aspx. It does not need to have have any properties.

If you think of it, Default.aspx IS your start page, we only make sure that Episerver understands that too by adding a Page Type for it :)

For the navigation - that depends on how you build your menu. Normally you set the pages that are your level 1 in the navigation as children below the start page. See the Alloy Template package for inspiration.

#180097
Jun 29, 2017 16:36
Vote:
 

Hi Alf,

Okay.. so Iwas trying to do what you said To get this workaround, you don't have to have a page type for the Default.aspx

But now you are saying I need to make a page type for Default.aspx?

Sorry, now I'm confused :) Can we go back to the beginning.

From what I understand, I need to make a page in Episerver for some reason, with no content and make it the root page of everything. (Does this mean I have to delete all my existing pages and start over? or is there a way to move them?)

Then I need to make a page type under Models, also with no content or fields, and add that to Episerver? (Does my Default.aspx need to be in /Views then?)

Then I need to go to the Admin page, create a web site and set the root page to be the start page and then I'll  be able to navigate "/" - have I got all the steps?

P.S. holy cow this reCAPTCHA is annoying - I had to click through 8 screens last time! :)

#180101
Jun 29, 2017 19:26
Vote:
 

Hi,

I'm sorry if I don't explain clearly :)

What I meant was that you don't need to use the Page Type on Default.aspx.

So in simple steps. I might contradict what I previously wrote but I guess this is the easiest way to make it work.

  • Create a Page Type for your Start Page in Models
  • Change Default.aspx to inherit TemplatePage<StartPage>
    • This should automatically connect the StartPage pages to this .aspx, if not there are some ways to help Epi
    • You don't need to move the Default.aspx to Views, but it's a good practice
  • Create a page of the type StartPage under Root in the page tree
  • You can move all your existing pages to become children under the start page
  • Go to admin
  • Create a new website and select your start page
#180102
Jun 29, 2017 19:32
Vote:
 

Hi Alf

Thanks for all of your help. In following these steps, it works now with the page I wanted.

Thanks!! (And now I can stop having to "select all squares with street signs..." :) )

#180103
Jun 29, 2017 19:57
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.