SharePoint – deploying a Webform

I am new to this new and exiting world of sharepoint, and i like it so far (c: but no pain no gain ,..
so this my expirience so far. I installed the lates version of Sharepoint designer ,.. and this is where fun beguins

One of my fist challenges was to an 2.0 webform to sharepoint and this is what i did,..

1) start runing around like GRAZZZYY,,..
2) make your code,. when it works
3) Set up your version of SharePoint to display errors, if you don’t you’l end up with nothing but “An unexpected error has occurred”
3.a) in webconfic change <SafeMode MaxControls=“200“ CallStack=“false“… to <SafeMode MaxControls=“200“ CallStack=“true“…
3.b) <customErrors mode=“Off“/>
4)Next problem is how to you add code behind to your aspxes
4.a) Build your WebPart and copy dll to your sharoint solution bin folder.
4.b) In Sharepoint designer, create your aspx page and copy your code in to it.
4.c) Change Inherits if nead to,.. remember class first then assembly.
4.d) In Webconfic add folowing

<SafeControl Assembly=”” Namespace=”” TypeName=”*” Safe=”True” /> this enabeles all your aspxes which uses this namespace for sharepoint.
4.e) In Webconfic change CallStack=”false” to CallStack=”true” in <SharePoint><SafeMode>
4.f) In Webconfic add folowing to <SafeMode><PageParserPaths>
<PageParserPath VirtualPath=”/*” CompilationMode=”Always” AllowServerSideScript=”true” IncludeSubFolders=”true” />
this enabels all event handeling for buttons and others.

and this is it ,.. You have done it ,..
by the way thanks to Will for a briliant article it was a big help ,.. i can recomend you to read it ,..

over and out ..


wired button post-back bug

It is now twice that I have encountered this problem, so I decided writing about it. Why does click on <button> HTML controls, generate two post backs and the weirdest thing is, it is doing this at random ,.. You can only see it using fiddler, but I have no explanation for it. The bottom-line you should be careful using <button> HTML controls in you code, and try to use <asp:button> or  <asp:hyperlink> in stead.

With some CSS you can style those to look just like buttons.

what to do if membership.validateuser(username, pwd) allways return false

To start with,,.. this has been quiet a head eik for me,.. after i have written the code for a Webform with some user validation on it ,.. and to my amazement everything worked fine except the validation ,.. the username and password matched  up with the datatabse ,.. but membership.validateuser() refuzed stubbernly to validate correctly.. and nothing what i did could make it do otherwise ,.. It was quite a while before I realized what the problem was ,.. 

It appears that  Membership.ValidateUser will always return false if one of thise conditions is true:

  1. Member is locked out (IsLockedOut ==true).
  2. Member is not approved (IsApproved == false).
  3. And of curse if Member username and/or password are incorrect.

Problem solved ,..

Using aspx webform to perform scheduled tasks without sitecore task manager

I wanted to open an aspx page to perform a simlpe scheduled task like sending some mails using Siteoce, and this is how simple it is ,..
first you have to make your webform of course.. and then open your webconfic and look for the <scheduling>tag and..

<agent type="Sitecore.Tasks.UrlAgent" method="Run" interval="01:00:00">
param desc="url">http://yourUrl.blah/sitecore/MySite.aspx</param>

this agent executes ones every hour, set by this atrbute interval=01:00:00

to make it work you have to exclude this site from beeng renderes as a sitecore site,.. and this is how you do it ,..

Set IgnoreUrlPrefixes to a '|' separated list of url prefixes that should not be
regarded and processed as friendly urls (ie. forms etc.)
setting name="IgnoreUrlPrefixes" value="/sitecore/default.aspx|/YOUR/FOULDER/NAME/HERE"


How to open a text file and convert it to excel at the same time ,..

There are lots of ways of doing this ,.. but this is perhaps the eaciest (c:

public static void Write()

HttpResponse response =HttpContext.Current.Response;

// make sure nothing is in response stream
response.Charset =

// set MIME type to be Excel file.
response.ContentType ="application/";
"Content-Disposition", "attachment; filename=\"MyExcel_" + DateTime.Now.ToString() + "\".xls");

// Send the data. Tab delimited, with newlines.
System.IO.StreamReader reader = new System.IO.StreamReader(HttpContext.Current.Request.MapPath("~/Mytext.txt"));


// Close response stream.


prettey cool if i may say so ,.. (c: