Search

Categories

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Send mail to the author(s) E-mail

# Saturday, August 07, 2010

Makes it easier to deploy in VS2010 (using web.debug.config and web.release.config)

From the instructions here:

http://www.sitefinity.com/devnet/forums/sitefinity-3-x/set-up-installation/installing-sitefinity-as-a-web-application-in-visual-studio.aspx

The biggest part is that SiteFinity uses User Profiles which are not available at design time in a web application (therefore it doesn’t compile).  To get around this we use the Web Profile Builder, which is a wrapper class which acts as a workaround.

This was the only code I had issue with:

//ProfileCommon profile = (ProfileCommon)ProfileCommon.Create(CreateUserWizard1.UserName, true);

WebProfile profile = new WebProfile(WebProfile.Create(CreateUserWizard1.UserName, true));
 
Then we convert to a Web Application.  The major difference is that in web sites each page has its code-behind compiled into a seperate library, whereas in a web application all code behind gets compiled into a single library.

There is a secondary file too called yourpage.aspx.designer.cs which moves all of the control declarations into it (a partial class).  This allows VS2k5, 2k8, 2010 to generate code without dumping into the main .cs class, and allows the class access to the controls on the page.

Used FileZilla and it all works.  Now, next post on VS2010 publishing / deploying!

Comments [0] | | # 
# Thursday, August 05, 2010

I’m getting data using LINQ to SQL, then showing on the front end.  If I want a null coming from the database to default to something:

<telerik:GridTemplateColumn HeaderText="Image" UniqueName="Image">  
<ItemTemplate>
<asp:Label ID="asdf" runat="server" Text='<%# String.IsNullOrEmpty(Convert.ToString(Eval("Image1"))) ? "noImage.jpg" : Eval("Image1")%>'></asp:Label>
<a href="<%=VirtualPathUtility.ToAbsolute("~/")%>showFrontEndMaterialDetail.aspx?materialId=<%# Eval("Id")%>">
<img src="<%=VirtualPathUtility.ToAbsolute("~/")%>Images/Uploaded/Thumbs/<%# Eval("Image1") ?? "noPhoto.jpg" %>"></img></a>

</ItemTemplate>
</telerik:GridTemplateColumn>


Thanks to these people:
 

http://stackoverflow.com/questions/3410942/linq-to-sql-default-value-nullable

Comments [0] | | # 

When displaying a repeater on an aspx page:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem, "FileName")%>
</ItemTemplate>
</asp:Repeater>

or shorter:

<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<%#Eval("FileName")%>
</ItemTemplate>
</asp:Repeater>

It is important to remember to make FileName a property and not just a public field ie this works

public class ImageThing
{
public string FileName {get; set; }
}

private void DisplayThumbnailImages()
{
ImageThing imageThing1 = new ImageThing();
ImageThing imageThing2 = new ImageThing();
imageThing1.FileName = "asdf.jpg";
imageThing2.FileName = "aaa.jpg";

List<ImageThing> imagesToRender = new List<ImageThing>();
imagesToRender.Add(imageThing1);
imagesToRender.Add(imageThing2);

Repeater1.DataSource = imagesToRender;
Repeater1.DataBind();
}

this doesn’t

public class ImageThing
{
public string FileName;
}

A property encapsulates a field.

Comments [0] | | # 
# Wednesday, August 04, 2010

31mins.  He took a template from freecsstemplates.org and put it into SiteFintiy

http://www.sitefinity.com/devnet/webinars/designing-skinning-with-sitefinity.aspx

Comments [0] | | # 
# Monday, July 26, 2010

EXEC sp_MSforeachtable @command1 = "DROP TABLE ?"

Be careful you are in the correct db!  I had to manually drop some tables in the correct order due to FK’s

Comments [0] | | # 
# Monday, July 12, 2010

A web application testing system

http://seleniumhq.org/download/

Selenium Remote Control runs tests in multiple browsers.. can do in C#

Selenium Grid can distribute tests across multiple servers.

http://thetestingblog.com/2010/02/02/selenium-rc-in-console-app/

Here is a console, running in C# calling the Selenium libraries, which call a java webserver

To start the server dowloads\selenium-remote-control-1.0.3   java -jar selenium-server.jar

There did seem to be an issue with the include statement of the Selenium core.. I got it working by deleing the using statement, then Ctrl . somewhere..  code in C:\code\SeleniumTest

image

It is easy to put in a rough speed test (8secs here.. was 45 secs with no caching and having to start up the webserver after having left it).

To explore soon:

- Fill out forms

- Actual assertions (can use nUnit)

- Handle ‘test’ edition of sitefinity gracefully

- Force no cache on browser

- Test functionality of site on different browsers

Comments [0] | | # 
# Tuesday, July 06, 2010
( ASP.NET MVC | Moq )

While using Moq to test an MVC app, and Scott Hanselman’s NerdDinner app, I kept getting these strange errors.

Problem was permissions on:

C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\MachineKeys

In Windows XP Pro, you need to disable simple file sharing.. from http://www.windowsbbs.com/windows-xp/52502-cannot-change-permissions-folder.html

image

Then I set perms to be full control to everyone:

image

More granular perms are in here: http://groups.google.co.uk/group/RhinoMocks/browse_thread/thread/26df68ff01567509/5ddebf407228edc4

Now this code works:

image

On Win7: C:\Users\All Users\Microsoft\Crypto\RSA\MachineKeys

Takes some messing around with granting ownership of the directory, then setting full control to everyone.

Comments [0] | | # 
# Friday, July 02, 2010

Useful if you want the ASPNETDB to be in your local SQL Server instance rather than a flat file (which can be troublesome).

image

Use trick of connection via server explorer, then F4 properties, then can copy and paste connection string into web.config.

image

Comments [0] | | #