November Happy Hour will be moved to Thursday December 5th.

XML Page Provider

Vote:
 

Hi,

I am  bit new to the Episerver World ,I want to connect  external database to the piserver.

I m trying to do it with the XmlPage Providors. For that I have created a new page in the page hierarchy(Type normal) and then add refrence to dll (xmlPageProvider.dll) and also add xml file and the code in my web.config ie

<pageProvider>providers>add name="XmlPageProvider" type="CodeSamples.XmlPageProvider, XmlPageProvider" entryPoint="75" capabilities="Create,Edit,Delete,Move,Copy" filePath="~\externalpages.xml"/>providers>pageProvider>

but my page is not showing up anything it displays only the name of the page.

#43613
Sep 20, 2010 14:18
Vote:
 

The xml provider is for creating pages structured in an xml file. (Given in the filePath attribute above) If you are trying to connect to a database, just configure your EPiServerDB connectionstring in the file connectionstrings.config

Set up the Data Source to your db server name and your initial catalog to match your database name.

If you are actually trying to store your data in an xml file with the xml page provider, you can read more about the provider here:
http://world.episerver.com/Articles/Items/Introducing-Page-Providers/

#43635
Sep 20, 2010 21:52
Vote:
 
#43643
Sep 21, 2010 6:46
Vote:
 

Hey,

Thanks for the reply.I am storing my data in an xml file with the xml Page provider.I am following the same thing but my page is not displaying the xml content . In which location I have to add provider code in my web.config.I have placed it in between the </episerver.baseLibrary> tag. 

</classFactories><pageProvider><providers>add name="XmlPageProvider" type="CodeSamples.XmlPageProvider, XmlPageProvider" entryPoint="75" capabilities="Create,Edit,Delete,Move,Copy" filePath="~\externalpages.xml"/></providers></pageProvider></episerver.baseLibrary>

and page provider node in the site's page tree is a page of start type.

#43644
Edited, Sep 21, 2010 6:47
Vote:
 

You should not have it inside the episerver.baselibrary tag. Take it out of web.config and put it inside the <episerver> tag in your episerver.config file.

#43656
Sep 21, 2010 9:34
Vote:
 

Hey,

Thanks for the reply.I just have put the code inside the episerver.config, but its giving reeor message:

Cannot create an instance of type CodeSamples.XmlPageProvider, XmlPageProvider

#43657
Sep 21, 2010 9:38
Vote:
 

The type attribute requires a full namespace. Check what namespace you have and replace "CodeSamples.XmlPageProvider, XmlPageProvider" with your namespace

#43660
Sep 21, 2010 10:34
Vote:
 
#43661
Sep 21, 2010 10:38
Vote:
 
#43662
Sep 21, 2010 10:39
Vote:
 
#43671
Sep 21, 2010 15:01
Vote:
 
Hey, Following error is thrown away when I try to run my XMLPageProvider. Server Error in '/knowledgeWeb' Application. -------------------------------------------------------------------------------- Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.NullReferenceException: Object reference not set to an instance of an object. Source Error: Line 53: throw new ConfigurationErrorsException("XmlPageProvider requires configuration attribute filePath that should be a application relative path"); Line 54: } Line 55: _filePath = HttpContext.Current.Server.MapPath(configParams["filePath"]); Line 56: ChangeReadonlyFlagOnFile(); Line 57: } Source File: C:\Documents and Settings\sainibha\Desktop\XmlPageProvider\XmlPageProvider\XmlPageProvider.cs Line: 55 Stack Trace:
#43764
Edited, Sep 23, 2010 9:02
Vote:
 

Are you still using the configuration from your first post? If so, have you downloaded the externalPages.xml file and placed it in your site's root folder? 

The code crashes on a line where it is trying to retrieve the physical path of the xml file.

#43767
Sep 23, 2010 9:55
Vote:
 

Hey,

thanks for the reply

I got following error in my page.

!EPiServer.Core.InvalidPropertyValueException was unhandled by user code
  Message="\"05/20/2010 09:04:00\" is not a valid value for \"EPiServer.Core.PropertyDate\"."
  Source="EPiServer"
  InnerException: System.FormatException

#43773
Edited, Sep 23, 2010 10:43
Vote:
 

Answer before you changed your previous post:

I'm confused, is HttpContext.Current null???

Try this:
- set a breakpoint at line 55 in XmlPageProvider.cs
- go to the Immediate Window, type configParams["filePath"] and press enter. What do you get?
- same, but type HttpContext.Current.ToString()  What do you get?
- if the previous doesn't fail, do you get anything when you type (copy/paste) HttpContext.Current.Server.MapPath("externalpages.xml") ?

#43783
Edited, Sep 23, 2010 12:52
Vote:
 

Hi,

Thanks for the reply.......!

1) I have added breakPoint in line 55 in XmlPageProvider.

2) configParams["filePath"] is showing "~/externalPages.xml"

3) HttpContext.Current.ToString() displays : object.ToString is a Method which is not valid in given context.

4) After typing HTTPContext.Current.Server.MapPath("externalPages.xml") result is Http Context.Xurrent is null.

I tries this previously  and didnt got any solution so I changes my this line No 55 to following one ie:

_filePath = AppDomain.CurrentDomain.BaseDirectory + @"/externalPages.xml";

and now I am getting filePath.

#43784
Sep 23, 2010 13:13
Vote:
 

Hi,

Thanks for the reply.......!

1) I have added breakPoint in line 55 in XmlPageProvider.

2) configParams["filePath"] is showing "~/externalPages.xml"

3) HttpContext.Current.ToString() displays : object.ToString is a Method which is not valid in given context.

4) After typing HTTPContext.Current.Server.MapPath("externalPages.xml") result is Http Context.Xurrent is null.

I tries this previously  and didnt got any solution so I changes my this line No 55 to following one ie:

_filePath = AppDomain.CurrentDomain.BaseDirectory + @"/externalPages.xml";

and now I am getting filePath.

#43785
Sep 23, 2010 13:13
Vote:
 

Ok. Regarding the InvalidPropertyValueException you get now, this might be related to localization. The date format in the XML file is mm/dd/yyyy hh:mm:ss  Not sure about dateformats in India, but try to change the dates in the XML to match your date format.

#43786
Sep 23, 2010 13:18
Vote:
 
#43787
Sep 23, 2010 13:24
Vote:
 

Hi,

Hey..........Yeh! My page is now displaying the xml content .

Thank you so much for the replies.:)

Now the only thing I want to know is that  in XMLPageProvider I got XmlPageProvider.CS and complete solution that I just added as a reference in my project. Is the customPageproviders is also same .How do I get the databaseProvider.CS,Or I have to create it on my own.

Thanks

Bharti

#43788
Edited, Sep 23, 2010 13:28
Vote:
 

Do you mean a custom database provider? When you install EPiServer, the default storage option is database. 

#43805
Sep 23, 2010 23:02
Vote:
 

Hey,

Yes my mean is Custom DatabaseProvider.like in the following link:

http://world.episerver.com/Templates/Forum/Pages/Thread.aspx?id=43613&epslanguage=en&pageIndex=2

but the NorthwindProductProvider.CS and the Northwind.dbml.Is this a class or what .

#43818
Sep 24, 2010 11:40
Vote:
 

The link is to this page :-)

#43824
Sep 24, 2010 15:23
Vote:
 

Sorry..........:)

http://guides.episerver.com/smartass/players/guideplayer/GuidePlayer.jsp?Guide=http://guides.episerver.com/smartass/media/20081113/37/Guide.xml

#43825
Sep 24, 2010 15:26
Vote:
 

Sorry..........:)

http://guides.episerver.com/smartass/players/guideplayer/GuidePlayer.jsp?Guide=http://guides.episerver.com/smartass/media/20081113/37/Guide.xml

#43826
Sep 24, 2010 15:27
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.