Fred Mastropasqua's Facebook profile

HTTP Error 404.17 Not Found – Using WCF .SVC Service

by Fred Mastro 30. November 2009 10:23

So you’re getting IIS error’s when trying to run a .svc file that’s coded to use WCF or Windows Communication Foundation.

HTTP Error 404.17 - Not Found

The requested content appears to be script and will not be served by the static file handler.

or maybe..

HTTP Error 404.3 - Not Found

The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Took me awhile to realize I need to setup/configure IIS and WCF properly.  Here are the steps from MS, I went through and realized I had missed one component (IIS6 Scripting tools, who would have thought), which I probably didn’t need, but the big ones that I didn’t have WCF Http Activation installed.  After that, I registered WCF..

"%WINDIR%\Microsoft.Net\Framework\v3.5\WFServicesReg.exe" /c

and then I was golden, but there might be other things you are lacking or missing. So go through all the steps.

One-Time Set Up Procedure for the Windows Communication Foundation Samples

Tags: , ,

ASP.NET | IIS And Hosting | WCF

Set the DefaultButton inside a LoginView Control in a MasterPage

by Fred Mastro 25. November 2009 12:45

Ok if you google this you’ll get some solutions that say set the DefaultButton to ParentControlID$ButtonID

However, this didn’t work for me. I kept getting the same error no matter what I tried.

The DefaultButton of '<PanelID>' must be the ID of a control of type IButtonControl.

So I tried another approach that worked great.

On page load I found the Panel Control and found the button control and set the default button programmatically.

<asp:LoginView ID="LoginView1" runat="server">
    <AnonymousTemplate>
        <asp:Panel ID="pnlLogin" runat="server">
            <telerik:RadTextBox ID="tbUsername" runat="server" EmptyMessage="Username" />&nbsp;
            <telerik:RadTextBox ID="tbPassword" runat="server" EmptyMessage="Password" TextMode="Password" />&nbsp;
            <div id="SignIn" style="position: relative; z-index: 1; float: right; bottom: 21px;">
                 <asp:LinkButton ID="lbSignIn" runat="server" Font-Bold="true" Font-Size="Small" Text="SIGN IN" OnClick="lbSignIn_Click" />
            </div>
            <div id="divLoginLinks" style="position:relative; clear:both">
                <span class="GrayFooterFont"><asp:HyperLink ID="hlRegister" runat="server" Text="Register" NavigateUrl="~/Registration.aspx" /> | <asp:HyperLink ID="hlForgot" runat="server" Text="Forgot Password" NavigateUrl="~/ForgotPassword.aspx" /></span>
            </div>
        </asp:Panel>
    </AnonymousTemplate>
    <LoggedInTemplate>
        <small><asp:Label ID="lblLoggedInUsername" runat="server" /> | <asp:LinkButton ID="lbSignOut" runat="server" Text="SIGN OUT" OnClick="lbSignOut_Click" /></small>
        <asp:LinkButton ID="lbSignIn" runat="server" Font-Bold="true" Font-Size="Small" Text="SIGN IN" OnClick="lbSignIn_Click" CssClass="hidden" />
    </LoggedInTemplate>
</asp:LoginView>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    'If User is not logged in do this        
    Dim pnlLogin As Panel
    Dim lbSignIn As LinkButton
    pnlLogin = CType(LoginView1.Controls(0).FindControl("pnlLogin"), Panel)
    lbSignIn = CType(LoginView1.Controls(0).FindControl("lbSignIn"), LinkButton)
    pnlLogin.DefaultButton = lbSignIn.ID
    pnlLogin = Nothing
    lbSignIn = Nothing
End Sub

I’m sure I could have just hardcoded the lblSignIn ID to the pnlLogin, but no idea why I didn’t.

Tags: , ,

ASP.NET | VB.NET | Code Snippets

Play Ripped DVD’s on Windows Media Center

by Fred Mastro 24. November 2009 23:10

For Windows Vista:

Open Registry Editor (Start, Run, REGEDIT) and navigate to:

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Media Center\Settings\DvdSettings

Double-click the key ShowGallery and change the value from “Play” to “Gallery”.

For Windows 7:

Don’t need it, it’s already built this way.

Tags:

Microsoft | Media Center

jQuery Plug-In Links I’ve collected

by Fred Mastro 19. November 2009 16:03

Tags:

jQuery

SilverLight Reference Controls

by Fred Mastro 19. November 2009 14:57

Reference a control that’s is outside your View, or on your MainPage if you’re using NavigationFrame or your “Parent” window.

Assumption: MainPage UserControl page is your starting page and has a NavigationFrame and a View is loaded in a content window.

Method 1: (Assuming “MainPage” is the name of your MainPage or the x:Class it uses, x:Class="<AppName>.MainPage" and the TextBlock named “lblStep1”)

Dim Main As MainPage = CType(<AppName>.App.Current.RootVisual, MainPage)
        CType(Main.FindName("lblStep1"), TextBlock).Text = "Hello Test123"

Or Method 2:

CType(CType(<AppName>.App.Current.RootVisual, MainPage).FindName("lblStep1"), TextBlock).Text = "Updated Text"
 

 

Reference a Control in a User Control that’s on the same view.

  1. CType(siTest.FindName("lblStep1"), TextBlock).Text = "Testing"

Tags: ,

Code Snippets | SilverLight

Test SMTP Server via Telnet

by Fred Mastro 18. November 2009 09:28

As a developer I always have to write code to send emails, here's a quick way as a developer to make sure the SMTP Server is working properly.

Telnet to Port 25 to Test SMTP Communication

1. Telnet into Exchange or SMTP Server using port 25.
Command is telnet <servername> 25

c:\>telnet 192.168.0.5 25
220 fredmastro.com Microsoft ESMTP MAIL Service, Version: 6.0.3790.1830 ready at Sun, 29 Nov 2009 10:22:22 -0400

2.Start by typing the following:
helo <your domain name><enter>                 
response should be as follows
250 OK

 

c:\>helo
250 fredmastro.com Hello [10.x.x.x]



3. Type the following command to tell the receiving SMTP server who the message is from:

mail from: <your Email Address><enter>
response should be as follows
250 OK - mail from <your Email address>

For example,

c:\>mail from: fredmastro@fredmastro.com
250 2.1.0 fredmastro@fredmastro.com....Sender OK



4.Type the following command to tell the receiving SMTP server whom the message is to. Use a valid recipient SMTP address in the domain that you are sending to.

For example, if you are sending to someguy@gmail.com, you must be certain that someguy@gmail.com exists in your domain. Otherwise, you will receive an NDR.

rcpt to: <recipient address><enter>
response should be as follows
250 OK - Recipient <recipient address>

For example, 
c:\>rcpt to: someguy@gmail.com
250 2.1.5 someguy@gmail.com

5.Type the following command to tell the SMTP server that you are ready to send data:

data<enter>
response should be as follows
354 Send data.  End with CRLF.CRLF

c:\>data
354 Start mail input; end with <CRLF>.<CRLF>
Test Message
.

250 2.6.0 <someguy@gmail.com>
Queued mail for delivery

6. Close the connection by typing the following command:
c:\>QUIT

response should be as follows:
221 closing connection

Another good reference: http://www.messagingtalk.org/content/470.html

Tags: , ,

Developer Tools | Troubleshooting

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

A Certified MCSE (NT4 & 2k), MCDBA (2k), A+, CCA, with over 10 years of experience with Windows Networking and Development. Developing mainly in ASP.NET, VB.NET and T-SQL. Also develops in Objective-C (iPhone), XAML (SilverLight & WPF), C#, "Classic" ASP 3.0, ADSI,  VBscript, WScript.

Non-technical hobbies include other areas such as Movie watching (action, epic, comedy, some romantic comedy, well everything), Reading (Science Fiction, Fantasy, Detective and Programming categories), Film Editing, Directing with Special effects (using Adobe Premiere and Adobe After Effects), Dungeons & Dragons (D&D 4th Edition), Auto-Cross Racing & Cars (BMW M3, MazdaSpeed's), Motorcycles (Honda CBR 600), TV Shows (Flight of the Conchords, Lie To Me, DollhouseBattleStar Galatica, Smallville, Alias), Music (Akon, Billy Joel, Micheal Bublé, Bid Daddy Weave, T-Pain, Barlow Girl, Notorious B.I.G and more, love all types of music), and Religion (Christianity, debating and prophecies).


Web Tools - QuickLinks

Web tools I use more then others. Some of these are on my Link Collections page, but this made it easier for me to go to my site and click a tool.

  1. Telerik Code Converter (C# to VB/VB to C#)
  2. Lorem Ipsum - Dummy Text for Prototype Apps
  3. Web Color Values
  4. Open Source Icons

 

Highlights

  • Some websites I've worked on. This is a small collection of sites I've developed or added to awhile back.

  • Revenge Movie Trailer. Trailer I made with Adobe Premiere and After Effects. Jason Christman is the main star and I'm the director behind the camera.

  • Essential Software For your Mac. - I'm a Microsoft geek, but I've switched over to Mac. There was a lot of stuff I needed to get installed that I missed on my Windows machine. Also I had no idea how to do it :p Here's some help.

  • Speed Football. I wanted to make a special effect like the Smallville or Superman running fast. All the other ones I've seen, the person in the frame was the only moving object while everything else was blurred. I wanted to create the effect but interact with another normal moving object.
  •    
  • Code Snippets and Quickies. Sometims I find something or develop something that I think is useful and it can be copied and pasted anywhere for someone to use. Here's a collection of things I've posted on.
  • Books I've Read or Reading