+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Major problem in IIS 7, Web User Control fails with extensionless page

Major problem in IIS 7, Web User Control fails with extensionless page

7 posts, 0 answered
  1. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    15 Nov 2010
    Link to this post
    Hi,

    I have a really weird problem which I hope you can shed some light on.

    Basically I have a URL which is /News/Weather.  Within the page, I've added a user control I wrote which details the weather report. 

    This page is working fine if I go to /News/Weather.aspx, but if I go to /News/Weather (note the lack of .aspx) it doesn't work, complaining that the 'object reference must be set to an instance of an object'.

    The question is - why does it work with .aspx, but not without - it makes no sense?

    Any ideas?

    Tony
  2. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    15 Nov 2010
    Link to this post
    Sorry - it's 3.7 incidentally!
  3. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    15 Nov 2010
    Link to this post
    I've narrowed it down to the following chunk of code :

    Trace.Write("Checking the Profile...")
                    If Profile.TJBSoftware.GoogleCityChoice IsNot Nothing AndAlso Profile.TJBSoftware.GoogleCityChoice <> "" Then
                        Trace.Write("Running LINQ query...")
      
                        Trace.Write("Is _Cities nothing?" + IsNothing(_Cities))
                        Trace.Write("Is Profile nothing?" + IsNothing(Profile))
      
                        Dim _NewList = From _Values As String In _Cities _
                                       Select _Values _
                                       Order By Not _Values.Equals(Profile.TJBSoftware.GoogleCityChoice.ToString), _Values.Equals(Profile.TJBSoftware.GoogleCityChoice.ToString)
      
                        rpt_Cities.DataSource = _NewList
                    Else
                        rpt_Cities.DataSource = _Cities
                    End If

    If I go to Weather.aspx, it'll work through everything no problem.  If I go to 'Weather', it causes an exception  after the trace statement for "Checking the Profile", indicating that Profile or it's sub group is Nothing.

    Am I missing something in the web.config perhaps?  I don't understand why the Profile is available for the.aspx page, but not for the non-suffixed address?

    Hope this helps!
    Tony
  4. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    15 Nov 2010
    Link to this post
    Some more info before I call it a night!  Here's the web.config settings for the Profile :
    <profile defaultProvider="Sitefinity" automaticSaveEnabled="true">
                <providers>
                    <clear/>
                    <add name="Sitefinity" connectionStringName="DefaultConnection" applicationName="/" 
      
    type="Telerik.DataAccess.AspnetProviders.TelerikProfileProvider, Telerik.DataAccess"/>
                    <add name="TJBSoftware" connectionStringName="Sitefinity" applicationName="/SitefinityBespoke" 
      
    type="System.Web.Profile.SqlProfileProvider"/>
                </providers>
                <properties>
                    <add name="FirstName"/>
                    <add name="LastName"/>
                    <add name="Position"/>
                    <add name="Photo_Hidden"/>
                    <add name="Photo" defaultValue="~/Sitefinity/Common/Images/defaultavatar.gif"/>
                    <group name="InstantMessenger">
                        <add name="IM_Type"/>
                        <add name="IM_Value"/>
                    </group>
                    <group name="Phone">
                        <add name="Value"/>
                        <add name="Type"/>
                    </group>
                    <group name="TJBSoftware">
                        <add name="GoogleWeatherTemp" defaultValue="C" allowAnonymous="true" 
      
    provider="TJBSoftware"/>
                        <add name="GoogleCityChoice" allowAnonymous="true" provider="TJBSoftware"/>
                    </group>
                </properties>
            </profile>

    I recall now that I had to add my own group with the ASPNet provider.  Would this have anything to do with the fact that I'm using a different provider, and that for some reason the URL rewriting in IIS 7 is somehow interfering with that?

    Cheers,
    Tony
  5. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Nov 2010
    Link to this post
    Hello Tony,

    Try setting

    <system.webServer>
     
      <modules runAllManagedModulesForAllRequests="true">

    This attributes forces IIS to ignore the preCondition=”managedHandler” attribute, hence all managed modules will be invoked for all requests to web application. This also ensure that the url rewriting is called on time and have a chance to re-write all URL requests to the server. The problem is that FormsAthentication and RoleManager modules are not available for extensionless requests. You can find more details here:ASP.NET Integration With IIS 7.0

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  6. Tony Bolton
    Tony Bolton avatar
    33 posts
    Registered:
    06 Oct 2009
    16 Nov 2010
    Link to this post
    You sir, are a genius!

    That works perfectly.  If anyone else has the same problem, and you're using discountASP.net like I am, you'll also need to set   <validation validateIntegratedModeConfiguration="false"/> within system.webServer, otherwise you'll get an IIS 7 error.

    Thanks again Ivan!
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    16 Nov 2010
    Link to this post
    Hi Tony,

    Thanks for getting back to me. I am always happy to resolve some issue and help to the community.

    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
7 posts, 0 answered