cancel
Showing results for 
Search instead for 
Did you mean: 

Re-use opf existing code

Former Member
0 Kudos

For our in-house ASP.NET development, we have a library that provides a lot of useful functionality. We can configure this library through the use of our own configuration sections in the web.config file. This library has been used by a team of developers for multiple projects during the last few years.

Right now, I am investigating the possibility to reuse this code in a PDK for .NET project. For this reason, I took the following steps:

- I included a web.config file in my project. This file is included in the PAR file and deployed to the server as it should.

- Next, I deliberately made an error in the web.config file. At that point, I can no longer call any iView from my portal application, as I get a configuration error from the Microsoft .NET Framework. To me, this was a promising sign.

- Finally, after correcting the file again, I tried to call a function from our library. Then, I noticed that no values from the web.config file have been read. All settings have a blank value.

Can anyone explain to me <b>why</b> it looks as if the web.config is parsed, while I don’t get any of the values that are included in the file?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Geert,

Your web.config isn't meant to be used in runtime. only one web.config exists is used by the runtime, which is all due to the way the runtime is built (all deployed apps are loaded and run together so they can "talk" to each-other, among some other technical reasons).

The fact that the framework checks it's validity is indeed funny, I suspect it's due to the fact the they search for it in all sub-folders and verify it.

As for the option of re-using this code... you might be able to use the existing config file I've mentioned (you can find it in the runtime installation folder), but remember it will be accessible to all apps, and that this is not supported usage.

Regards,

Ofer

Former Member
0 Kudos

Ofer,

Thanks for your answer. Although I kind of expected an answer like this, I wanted to be sure that I didn’t miss any options. I think that right now the best thing for us is to change the existing code so that it can be initialized using a dedicated configuration file.

I wanted to reward some points for this answer; however the control to do so doesn’t come up. I suspect the reason probably being that my computer has been replaced recently. I suggest that you create an extra (simple) reply to this one.

Thanks again,

Geert Maertens

Former Member
0 Kudos

Hi Geert,

I didn't think to mention it before, but since you say you plan to change the code, I do want to give you a tip:

A config file might not be the best solution. if you have, or one day plan to have, more than one runtime, in more than one place, config files will be hard to maintain.

In PDK 2.0 (which I don't know if you're using) you can define a system template, which you can then use to store any kind of configuration information. This, when deployed, will be stored in the portal's system landscape and the data can be accessed quite simply in code. but also, you will have (without any extra work) administrative UI to edit this system information. Also, if needed you will have the option of user mapping etc'.

take a look at <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/dotnet/pdk%20for%20.net/developer's%20Guide%20PDK%202.0%20for%20.NET/How%20to/CreatingPortalSystemTemplate.htm">this</a> how-to, which should give you a good idea where to start.

As for the points, if you say how many, a moderator can do it.

Regards,

Ofer

Answers (0)