Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 25th, 2006, 01:26 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sclaggett
Default Blob Code Incorporation

First I would like to thank you for a nice head start on a blog application. My only comment on the book was why did you not add something for comments. Then low and behold you put that on the site. Thanks.

I am moving from linux to asp with windows here so please bear with me. Is it ok to just overwrite the existing web.config file in my current site. Seems to work ok with the SQL database set. Also I will point to a modified access database. What should this code line be changed to ( I changed the default)
<add name="AccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=C:\Inetpub\wwwroot\InstantResults\Blog\App_ Data\Blog.mdb;User Id=admin;Password=;" providerName="System.Data.OleDb" />

The database is still blog.mdb and in the app_data directory below the root. I tried some things but could not get it to work at all after swithing from SQL to Access


Is there anything else that I need to be concerned with?:)
 
Old July 25th, 2006, 03:11 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi sclaggett,

Glad you like the book. And yes, we made all the "enhancements" to the applications available as a download on this site and the on CD-ROM. Each chapter thus has its own "walk-through" that shows you how to extend the application.

Whether you can overwrite the web.config file depends on its current contents... ;) If there's something important in it, don't overwrite it. Otherwise, if it's just a default file you can overwrite it.

C:\Inetpub\wwwroot\InstantResults\Blog\App_Data\Bl og.mdb points to a database called Blog.mdb in the App_Data folder of a site located somewhere under C:\Inetpub. If your site is located somewhere else, you need to modify the path accordingly. Fortunately, ASP.NET comes with something I like to call App Folder Expansion. Basically, you can add something like |DataDirectory| in your connection string which at run-time is expanded to the full path of your application's App_Data folder. So, even if you don't know the exact folder path (common in an ISP scenario), you can still target the App_Data folder. This should do the trick:

add name="AccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0 ;Data Source=|DataDirectory|Blog.mdb;User Id=admin;Password=;" providerName="System.Data.OleDb" />

For more information, check out this page: http://msdn2.microsoft.com/en-us/library/hktw939c.aspx

Does this help?

Have fun with the blog. Is you site going to be publicly available?

Imar

---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old July 25th, 2006, 04:11 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sclaggett
Default

Imar,

Thanks for the quick response. That has fixed the pointing problem I had; However the login will not give me access when I use Administrator and password Admin123#. Did this change. I simply copied the login.aspx and I have set the web.config role manager to False. See file included.

I am reworking a website for my mother. Her mother published a cookbook in the 40's and was food editor for a paper in Toronto Canada. She died early and my mother did not know her well. She has always been into cooking so I decided to relaunch the book on the web and let my mom add her 1000's of recipes etc...

It will be at http://www.threemealsaday.com (test mode right now)

Hope you enjoyed the world cup.

Thanks in advance for the response.

Stuart

 PS this is not my profession :D

Code:
<?xml version="1.0"?>
<!-- 
    Note: As an alternative to hand editing this file you can use the 
    web admin tool to configure settings for your application. Use
    the Website->Asp.Net Configuration option in Visual Studio.
    A full list of settings and comments can be found in 
    machine.config.comments usually located in 
    \Windows\Microsoft.Net\Framework\v2.x\Config 
-->
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
  <appSettings>
    <add key="DefaultConnectionString" value="AccessConnectionString" />
    <add key="EmailFrom" value="You@YourProvider.Com"/>
    <add key="EmailTo" value="You@YourProvider.Com"/>
    <add key="FCKeditor:UserFilesPath" value="/Blog/UserFiles"/>
  </appSettings>

  <connectionStrings>
    <add name="SqlServerConnectionString" connectionString="server=(local)\SqlExpress;AttachDbFileName=|DataDirectory|Blog.mdf;Integrated Security=true;User Instance=true" providerName="System.Data.SqlClient" />
    <add name="AccessConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|Blog.mdb;User Id=admin;Password=;" providerName="System.Data.OleDb" />

  </connectionStrings>
  <system.web>

    <!-- 
            Set compilation debug="true" to insert debugging 
            symbols into the compiled page. Because this 
            affects performance, set this value to true only 
            during development.

            Visual Basic options:
            Set strict="true" to disallow all data type conversions 
            where data loss can occur. 
            Set explicit="true" to force declaration of all variables.
        -->
    <compilation debug="true" strict="false" explicit="true" />

    <membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider"
            type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
            connectionStringName="SqlServerConnectionString"
            enablePasswordRetrieval="False"
            enablePasswordReset="True"
            requiresQuestionAndAnswer="True"
            applicationName="/"
            requiresUniqueEmail="true"
            passwordFormat="Hashed"
            maxInvalidPasswordAttempts="5"
            passwordAttemptWindow="10"
            passwordStrengthRegularExpression=""
            minRequiredPasswordLength="1"
            minRequiredNonalphanumericCharacters="0"
          />
      </providers>
    </membership>

    <roleManager enabled="False"
                 cacheRolesInCookie="true"
                 cookieName=".ASPROLES"
                 defaultProvider="SqlProvider">
      <providers>
        <add connectionStringName="SqlServerConnectionString" name="SqlProvider"
          type="System.Web.Security.SqlRoleProvider" />
      </providers>
    </roleManager>

    <!--
            The <authentication> section enables configuration 
            of the security authentication mode used by 
            ASP.NET to identify an incoming user. 
    -->
    <authentication mode="Forms">
      <forms loginUrl="~/Login.aspx" />
    </authentication>

    <!--
            The <customErrors> section enables configuration 
            of what to do if/when an unhandled error occurs 
            during the execution of a request. Specifically, 
            it enables developers to configure html error pages 
            to be displayed in place of a error stack trace.
    -->
    <customErrors mode="On" defaultRedirect="ErrorPage.aspx">
      <error statusCode="404" redirect="ErrorPage.aspx"/>
      <error statusCode="500" redirect="ErrorPage.aspx"/>
    </customErrors>

    <pages>
      <namespaces>
        <clear />
        <add namespace="System" />
        <add namespace="System.Collections" />
        <add namespace="System.Collections.Specialized" />
        <add namespace="System.Configuration" />
        <add namespace="System.Text" />
        <add namespace="System.Text.RegularExpressions" />
        <add namespace="System.Web" />
        <add namespace="System.Web.Caching" />
        <add namespace="System.Web.SessionState" />
        <add namespace="System.Web.Security" />
        <add namespace="System.Web.Profile" />
        <add namespace="System.Web.UI" />
        <add namespace="System.Web.UI.WebControls" />
        <add namespace="System.Web.UI.WebControls.WebParts" />
        <add namespace="System.Web.UI.HtmlControls" />
      </namespaces>
    </pages>

  </system.web>
  <system.net>
    <mailSettings>
      <smtp deliveryMethod="Network">
        <network host="smtp@YourProvider.Com" port="25" />
      </smtp>
    </mailSettings>
  </system.net>

</configuration>
Stuart

 
Old July 25th, 2006, 04:17 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Sounds like a good plan. I enjoy cooking myself, so I'll visit the site when it's ready... ;)

Anyway, it seems the password for the Access database is Admin#123. Can you please test that and confirm it? If that's the case, I'll ask Wrox to add it to the errata section for the book.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
 
Old July 25th, 2006, 04:23 PM
Registered User
 
Join Date: Jul 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sclaggett
Default

Ok that got past that gateway but landed me at the default.aspx page where as my blog page is defaultblog.aspx. Where to I change this and where else is that name change going to hurt me :-) I personally think it would have been better to have had that as blog not default.

So chalk up the errata sheet to page 202 para 5 last line change Admin123# to Admin#123

Cheers Stuart

 
Old July 25th, 2006, 04:32 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Redirecting after a successful login is done by the ASP.NET 2 run-time. You can configure the default page through the web.config file:

<authentication mode="Forms">
  <forms loginUrl="~/Login.aspx" defaultUrl="defaultblog.aspx" />
</authentication>

Notice that the Logout button in Default.aspx also has a reference to the Default page. Simply change this:

Response.Redirect("~/Default.aspx")

to

Response.Redirect("~/defaultblog.aspx")

or to this

Response.Redirect(Request.AppRelativeCurrentExecut ionFilePath)

which basically tells the page to redirect to itself. This last solution is probably the best way to do it, as it makes the code independent from the page name.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
While typing this post, I was listening to: Innervision by System Of A Down (Track 2 from the album: Steal This Album) What's This?
 
Old July 27th, 2006, 10:47 PM
Authorized User
 
Join Date: Mar 2006
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Microsoft team meamber is currently developing highly advanced
BLOG StarterKit in asp.net 2.0

His source is open for all. You can download it in C# or VB also.

here is the link...

www.shankun.com

Its currently in beta stage. ( working ofcourse )

Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
BLOB: file is empty after retrieving blob data thr taraprasad Pro JSP 0 May 22nd, 2008 10:02 AM
Sound files incorporation in web pages softarrow HTML Code Clinic 3 August 1st, 2007 11:39 AM
Blob Komila Classic ASP Professional 2 March 23rd, 2007 10:11 AM
BLOB kale_harish Pro JSP 0 February 14th, 2007 01:32 AM
ASP code for inserting BLOB field in Interbase pyc Classic ASP Databases 0 June 4th, 2003 12:02 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.