Default page in 6.03

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

In 603, the same address will cause an error
http://mywebaddress.com
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:
http://mywebaddress.com/default.avfp

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

You can choose between 2 solutions for that, please check:
http://stackoverflow.com/questions/6949597/setting-the-default-application-in-iis-7

Regards
Developer
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) != '/','/','')
            oResponse.Redirect(lcPath+'default.avfp')
        endif   
        *------+ Fix Ends   
        lcHTMLout= FILETOSTR(oProp.HtmlPath+lcHTMLfile)
        oProp.RunningPrg=[default]+oProp.Ext
        lcHTMLout= oHTML.mergescript(lcHTMLout)
Coordinator
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="http://mywebaddress.com/default.avfp" exactDestination="false" childOnly="false" />

For some reason, it's giving me bad request which ends up the address to have the following (really weird):
http://mywebaddress.com/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/

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 http://mywebaddress.com/default.avfp 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.

http://mybillings.ca

This will redirect to:
http://mybillings.ca\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:
Original:
<a href="<%=JUSTPATH(oProp.ScriptPath)+[/simplelist]+oProp.Ext%>"><font face="Arial" size="4">Simple VFP to HTML table</font></a>

Modified:
<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:
http://sessionlist.avfp/

Any issues that you can think using your suggestion?

Thanks.
Coordinator
Oct 17, 2013 at 2:00 AM
KARL_U,

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

Thank you.
Developer
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.

Regarding
For some reason, it's giving me bad request which ends up the address to have the following (really weird):
http://mywebaddress.com/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/default.avfp/
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....

oResponse.Redirect(lcPath+'default.avfp')

with ..

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

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

Update:
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.
e.g.
Uri = '<<server name>>/?'+oRequest.ServerVariables("QUERY_STRING")
oResponse.Redirect(Uri)

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

http://technet.microsoft.com/en-us/library/cc732969%28v=ws.10%29.aspx

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

http://www.iis.net/downloads/microsoft/url-rewrite

HTH
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) http://mywebaddress.com when the redirection to http://mywebaddress.com/default.avfp 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.

http://www.rootsofmine.com/avfp603/masterdetail.avfp?c=2
displayed just as
http://www.rootsofmine.com/avfp603/masterdetail

The problem here is, that if the user hits enter/reload with this url, should be another redirection rule to a default "section/action"
http://www.rootsofmine.com/avfp603/masterdetail.avfp

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

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

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)

Thanks
Coordinator
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 (http://72.219.220.152:444/BestFriendsSoftware) 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)
        oProp.RunningPrg=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)
        oProp.RunningPrg=[default]+oProp.Ext
        lcHTMLout= oHTML.mergescript(lcHTMLout)
    ENDIF
OR just go extensionless