Monday 23 November 2009

Hou do you get a hyperlink to run some code instead of linking to another location?

I was just working on a web page today and the design was such that there were multiple hyperlinks, two were to other pages but the third was a function to validate a portion of the current page. My problem was, how do I run some javascript instead of setting the anchor to another page?

I first tried to use an onclick handler without a url - now this did work but as a side effect of not having a url link the hyper link was not drawn showing the underline and coloring. So I added a url but of course the onclick functioned correctly but the page then navigated away.

Finally, and successfully, if you specify javascript:functionname() in the anchor href- where functionname() is defined in the script somewhere in your html document it works a charm. Additionally, after the javascript: you actually add multiple commands as long as they are semi-colon delimited. Obviously this can get a bit messy so better to have all the code in the function but the option is there!

Monday 9 November 2009

How do you get rid of "Failed to execute request because the App-Domain could not be created. Error: 0x80131902" event log error?

Failed to execute request because the App-Domain could not be created. Error: 0x80131902

Once I had got rid of the 403 forbidden error in the previous post I thought it was all systems go again, alas no! : ( lol.

No, I started to get a 'system was unable to deliver your page' or something similar which unfortunately I had not taken a note of, but the error message in the browser stated to look at the event log for complete details. The message I found was listed above - so what the heck do you need to do to get rid of this?

I should have realised but the problem probably stemmed form the fact I had only just installed IIS, and the .net framework was installed sometime before it. You need to re register the .net framework under IIS using:

Stop your IIS, either control panel or "net stop w3svc" via command prompt
(Use the Visual Studio command prompt to get the necessary paths setup to run the aspnet_regiis tool)
Use aspnet_regiis -ua - which will uninstall all the instances of .NET against your IIS
Then use aspnet_regiis -i to install the services again.
Start your IIS again, control panel or "net start w3svc"

Hopefully you are now away again....

How you get rid of the 403 forbidden error when trying to view your web page through Visual Studio?

How you get rid of the 403 forbidden error when trying to view your web page through Visual Studio?

I was trying to view a new website I had downloaded the source for at work and then view the page through Visual Studio browse - of course trying to the page direcly via localhost did give exactly the same problem but why?

Well, although I did come across some other problems to follow in another post, check your IIS settings... Load up IIS via the control panel admin tools, navigate to the default web site - right click and select properties. Now, via the popup that appears select the documents tab - in that list check that default.aspx and index.aspx are there - are they? So initially, in a string of events, I simply didn't have the .net default pages set....