none
How do I add C# code to Expression Web 4 for my Contact Us page RRS feed

  • General discussion

  • Hi,

    I built a web site in Expression Web 4 and it is ready to deploy except I need to add some C# MailMessage code so my server will forward mail from the Contact Us page.

    I want to use asp rather than PHP so I can test the input fields such as email addresses for proper formatted addresses.

    Is there a way to add the C# code in Expression Web 4 or add an aspx.cs file?

    If not how do I open the web site in Visual Studio 2010 and add an aspx.cs page. I tried opening it in Visual Studio and was unsuccessful.

    Thanks, Jim

    Thursday, February 14, 2013 3:06 PM

All replies

  • You add the page manually.  EW doesn't create .cs pages for you.  I assume you know the code required both for the .cs page and the code for the Page directive to reference it in your .aspx page.

    Or you use the single page model and put the C# code in a script block in your .aspx page, rather than on a separate .cs page.  (This is the simplest approach in EW.)

    See http://msdn.microsoft.com/en-us/library/015103yb(v=vs.100).aspx

    Thursday, February 14, 2013 5:15 PM
  • HighPeaks, please change your thread type from "Discussion," which it is not, to "Question," which it is. As the original poster, you are the only one who can do so. Thank you.

    cheers,
    scott


    Please remember to "Mark as Answer" the responses that resolved your issue. It is common courtesy to recognize those who have helped you, and it also makes it easier for visitors to find the resolution later.

    Thursday, February 14, 2013 7:39 PM