Default page in 6.03

Oct 16, 2013 at 4:02 PM
In version 553, this works fine ( display the default.asp)

In 603, the same address will cause an error
Caught .NET exception, source: MAIN.PRG 00005pux04xg err#= 1 line= 836 File does not exist.1 File does not exist. .NULL. .NULL. .NULL. .NULL. .NULL. C:\inetpub\wwwroot\mywebaddress\activevfp.dll message: C:\inetpub\wwwroot\mywebaddress\activevfp.dll

but if you do this, it works:

What am I missing here?
Oct 16, 2013 at 5:21 PM
Hello apaustria

You can choose between 2 solutions for that, please check:

Oct 16, 2013 at 10:33 PM
Edited Oct 16, 2013 at 11:45 PM
Hi apaustria,

I seems to have the same problem.

Did you fix it? If yes, can we all have the options you selected for its resolution please. Thx.

As a temporary workaround.. I have it working by forcing the default.avfp. in main.prg
*       USE mydbf  && test error
        CookieLogin()  && checks for cookie to authenticate
        lcHTMLfile = 'default'+oProp.Ext
        *--------+ Fix start
        If !FILE(oProp.HtmlPath+lcHTMLfile)
            *----+ Oct 2013.. default document is not being served by IIS.. force it.
            Local lcPath
            lcPath = ALLTRIM(oRequest.ServerVariables("SCRIPT_NAME"))
            lcPath = lcPath + IIF(RIGHT(lcPath,1) != '/','/','')
        *------+ Fix Ends   
        lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile)
        lcHTMLout= oHTML.mergescript(lcHTMLout)
Oct 17, 2013 at 1:58 AM
Hi Titu,

I just tried the suggestion as per Karl_U's given link... and failed.

Adding the Redirect thru IIS is basically adding a line in the web.config in the root of the website which is:
<httpRedirect enabled="true" destination="" exactDestination="false" childOnly="false" />

For some reason, it's giving me bad request which ends up the address to have the following (really weird):

Making the exactDestination to True will give you the following message in Firefox:
The page isn't redirecting properly

Plus the fact that it seems the address cannot be loaded as well if that parameter is set to true.

The solution you have presented seems to working fine, good job on figuring this one out.

Please note, I also need to change most of my links to make it proper. Here's an actual website with the default avfp template installed.

This will redirect to:\default.avfp ( by adding your code as suggested)

Clicking on the first link (Simple VFP to HTML table) works but modification has to be the following:
<a href="<%=JUSTPATH(oProp.ScriptPath)+[/simplelist]+oProp.Ext%>"><font face="Arial" size="4">Simple VFP to HTML table</font></a>

<a href="<%=JUSTPATH(oProp.ScriptPath)+[./simplelist]+oProp.Ext%>"><font face="Arial" size="4">Simple VFP to HTML table</font></a>

I need to put a dot (.) before the forwardslash plus the page (simplelist).

I haven't fixed the others, like:
Session VFP/HTML table

Address will go to the following:

Any issues that you can think using your suggestion?

Oct 17, 2013 at 2:00 AM

Have you experience this issue and did you resolve it using the suggestion thru those link in StackOverflow?

Thank you.
Oct 17, 2013 at 3:23 AM
Edited Oct 17, 2013 at 2:06 PM
Hi apaustria,

I am glad it's working. The hardcoding of default.AVFP needs to be removed though.

For some reason, it's giving me bad request which ends up the address to have the following (really weird):
I am not sure but I think this may happen due to response.redirect() trying to access default.avfp by going back into the WWW. ( instead of calling default.avfp internally) , when it has bad 'server variables' data at the time of making the call(??). The web.config 'fix' may be failing due to the this problem.

I think... and I I haven't tried it yet, but you may be able to replicate this issue even outside that 'Web.config', fix, i.e.... in AVFP as follows.

In my code snippet above.. replace the line....


with ..

Uri = [http://]+oRequest.ServerVariables("HTTP_HOST") +JustPath(oRequest.ServerVariables("URL"))+[/default.avfp]

Also, I don't have any pending issues that I can think of.

I went thru my notes. Just ignore my email.
I had this IIS looping problem in some other issue. It was when server name was forced in (hardcode) with missing page reference.
Uri = '<<server name>>/?'+oRequest.ServerVariables("QUERY_STRING")

Though similar, it would not be of much help in your case with web.config solution.
Oct 17, 2013 at 6:53 PM
Hi apaustria

In production environments I think you need to use IIS redirect

and there is also a URL rewrite extension if needed ( quite tedious )

Oct 17, 2013 at 8:39 PM
Follow up....

In a single case ( like yours) , the rewrite single rule is easy to configure, i.e. rewrites ( in client's browser url) when the redirection to is applyed.

The tedious part is when you want a large request to be displayed on the browser as it where a single "section" ( a lot of rewrite rules depending on page name and/or on first parameter etc) i.e.
displayed just as

The problem here is, that if the user hits enter/reload with this url, should be another redirection rule to a default "section/action"

that in turns will be rewrited or redirected as a "easy section again"

Hope I explain it in a way it make sense :)
Oct 17, 2013 at 8:50 PM

Thanks for all the suggested post you have given on this thread. My only beef is that, this thing was working on 553 that's is why I'm not really sure if redirect/rewrite is really needed for such thing. Again in version 553 this thing just works with no redirection needed. Calling the root website with always display the content of the default.asp/aspx.

Since Titu1 already gave a simple approach on fixing this, I just stick to it since it works so I don't have to configure my IIS configuration which for me is the way that it should.
Oct 17, 2013 at 9:09 PM
Hi apaustria

Ok, I don't know if the new Httphandler have modifyed the behaivour on default IIS page from 5.53 to 6.03 ( so we need confirmation aboutr that)

Oct 27, 2013 at 2:18 PM
Edited Oct 27, 2013 at 2:19 PM
default.avfp is not setup as a default page in IIS like default.aspx, default.htm, default.asp. index.htm, etc. You could add default.avfp to that list in IIS.

Or, as I think Titu1 mentioned, you can modify main.prg to go to your default page which I did for a recent project ( like this:
&& end of the CASE statement in main.prg
OTHERWISE   && get .avfp script

    IF !ISNULL(oProp.Action) .AND. FILE(oProp.HtmlPath+oProp.Action+oProp.Ext)
        * This section must stay here for pure scripting mode
        lcHTMLout= FILETOSTR(oProp.HtmlPath+oProp.Action+oProp.Ext)
        lcHTMLout= oHTML.mergescript(lcHTMLout)
    ELSE    && goto default page
*       USE mydbf  && test error
        CookieLogin()  && checks for cookie to authenticate
        lcHTMLfile = 'logmein.avfp'                       &&  new default page
        lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile)
        lcHTMLout= oHTML.mergescript(lcHTMLout)
OR just go extensionless