Portfolio sites updated – check them out!
I’ve just added another 11 sites i’ve worked upon or been involved in – you can see them in the portfolio. Covers technologies such as PHP, Asp.net, Umbraco, Kentico and more…
I’ve just added another 11 sites i’ve worked upon or been involved in – you can see them in the portfolio. Covers technologies such as PHP, Asp.net, Umbraco, Kentico and more…
In it’s simplest form, this project will allow you to serve files that are outside of the website folder structure to an end user – ok in other words you hide the real download location of your files.
An example:
You are a software company providing widget XYZ that costs $199 to purchase. In the past you had a secret hidden folder structure which was www.widget.com/securefiles/widgetxyzrelease.exe
This link was available to anyone once they purchased your software, however the probem was that this link could be passed around to anyone and everyone so not very secure.
What you actually want to do is provide a link like http://www.widget.com/your-account?file=widgetxyz and for your site to determine via it’s authentication system whether you were allowed to access it or not – if you have paid, you could provide this link which will then check you are logged in, check you are allowed to download it and then return the file to your browser for you to download. Much more secure.
Ok this is how you could set it up:
* Your site is setup in c:\inetpub\wwwroot\mySite
* Your secured files are outside of the wwwroot so c:\inetpub\mysecurefiles\*.* (this is where you dump your exes and other secure files)
* You ensure when your user purchases your software, they are logged into the site as a user and redirect them to the your-account page.
* This page has a user control that checks the query string, provides a mechanism to pull the file from the secure folder and serve to the user
Thats pretty much it.
I’m looking for collaborators for this package/project to improve and expand upon it’s core functionality. Things that could be added are:
* Customisable filetypes – currently only supports pdf, exe, msi and zip
* Embedding Google Analytics for tracking downloads against purchases/users
* anything else?
Source is included (7 zip file) and is currently compiled as .net 4.0 solution, if you are not using 4.7, you will need to recompile and relink in the correct version Umbraco dll’s for it to work – should work in all versions of Umbraco 4.x onwards
Project can be downloaded from http://our.umbraco.org/projects/backoffice-extensions/usecurefiles
Finding the right developer for your Umbraco project is all about being assured that the developer you pick has the skills you need.
There is only one way to become a certified Umbraco developer, by attending one the many Umbraco training classes. There developers get up to date knowledge from qualified trainers, ensuring that an Umbraco certified badge actually stands for a certain skillset and knowledge.
Great news, Simon has just obtained his certification to prove he can do all this and more.
To speak to Simon, follow this link to the Simon Antony website
IF you should happen to get an error like the following when saving an excel (or other office document I guess) workbook, try opening Excel/Word etc manually and see if the product needs activation! I came across this error earlier today after the project was working 100% and it turned out I just needed to activate the product!
Thanks Microsoft, you just wasted an hour of my time today trying to sort it out!
Server Error in ‘/’ Application.
Exception from HRESULT: 0x800A03EC
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC Source Error: Line 496: Line 497: // create the new file Line 498: xlWorkBook.SaveAs(strFileId, Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue); Line 499: xlWorkBook.Close(true, misValue, misValue); Line 500:
Heres a simple Macro for umbraco to allow you to update a logo or image on a page depending upon which page you have selected. You can use it to dynamically update images based upon content etc.
Here we check to see if the current page nodename is home (i.e. homepage) and set it to one thing, otherwise set it to something else. Obviously you can add as many conditions as you like.
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp " "> ]>
<xsl:stylesheet
version=”1.0″
xmlns:xsl=”http://www.w3.org/1999/XSL/Transform”
xmlns:msxml=”urn:schemas-microsoft-com:xslt”
xmlns:umbraco.library=”urn:umbraco.library” xmlns:Exslt.ExsltCommon=”urn:Exslt.ExsltCommon” xmlns:Exslt.ExsltDatesAndTimes=”urn:Exslt.ExsltDatesAndTimes” xmlns:Exslt.ExsltMath=”urn:Exslt.ExsltMath” xmlns:Exslt.ExsltRegularExpressions=”urn:Exslt.ExsltRegularExpressions” xmlns:Exslt.ExsltStrings=”urn:Exslt.ExsltStrings” xmlns:Exslt.ExsltSets=”urn:Exslt.ExsltSets”
exclude-result-prefixes=”msxml umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings Exslt.ExsltSets “>
<xsl:output method=”xml” omit-xml-declaration=”yes”/>
<xsl:param name=”currentPage”/>
<xsl:template match=”/”>
<xsl:choose>
<xsl:when test=”$currentPage/@nodeName = ‘HOME’”>
<div id=”logoDiv”>
<a href=”/”>
<img src=’/images/logo1.png’ alt=’This is logo 1′ class=’logomargin’ />
</a>
<!–<h1>Add some text here if you like</h1>–>
</div>
</xsl:when>
<xsl:otherwise>
<div id=”logoDiv”>
<a href=”/”>
<img src=’/images/logo2.png’ alt=’This is logo 2 for another page’ class=’logomargin’ />
</a>
<!–<h1>Add different text here also</h1>–>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Today I released a new version of the Simon Antony freelance developer website – it now covers all the areas I specialise within and hopefully gives my clients a new portal to visit. Over the coming months, more content will be added, including the ability for recruiters and clients to have their own login area and download files specific to them i.e. documentation, CV etc
http://www.simonantony.net is the place to go.
Simon
Was writing some XSLT for an Umbraco site recently, needed a copyright block in the footer so thought i’d just use the standard
©
syntax to add the copyright symbol, ©. When I tried to save the file, I got an error that the xml was invalid.
Turns out that © is not allowed so I used the numeric value instead
©
which works a treat.
I wonder how many times this has caught people out!
A couple of ways to stop client side validation firing, especially when using non asp.net controls:
Set the onclick event of the image/button etc to be onclick=”return false;” then instead of using the onclick event to fire a method, use the onmouseup event instead i.e. onmouseup =”javascript:do originalmethod(this);”
This will stop the page posting back but will fire the javascript method for the control in question. This comes in useful if you have a contact form with validation and a separate control i.e. for directions where you can enter a postcode and use javascript to fire off google maps in another page.
Ever had a long webpage with validation that fails on postback but returns the user to the top of the page instead of where you want them?
Annoying isnt it. Well in .Net Framework 2.0 (yes it’s been there a while now), you can use the property:
Page.MaintainScrollPositionOnPostBack = true;
Well this will force the user to be returned back to the last point they clicked i.e. could be a control, button, checkbox etc
Very useful and helps with improving the user experience, something we should all be striving for!
By default, you cannot group radiobutton controls within a repeater as the repeater mangles the names. I had this exact problem when changing from checkboxes to radio buttons – after searching Google for 10 mins, I found a post at the following site by Eric Smith which i’ll copy the relevant info here so I don’t lose it
http://www.codeguru.com/csharp/csharp/cs_controls/custom/article.php/c12371/
Add the following Javascript code to your page:
function SetUniqueRadioButton(nameregex, current) { re = new RegExp(nameregex); for(i = 0; i < document.forms[0].elements.length; i++) { elm = document.forms[0].elements[i] if (elm.type == 'radio') { if (re.test(elm.name)) { elm.checked = false; } } } current.checked = true; }
Now for the repeater itself,
protected void rptPortfolios_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType != ListItemType.Item && e.Item.ItemType != ListItemType.AlternatingItem) return; RadioButton rdo = (RadioButton)e.Item.FindControl("rdoSelected"); string script = "SetUniqueRadioButton('rptPortfolios.*Portfolios',this)"; rdo.Attributes.Add("onclick", script); }