The above code gives me the right value, 1234, from the web.config, so actually the extension works like I hoped. But is this the easiest/fastest/most wicked way of doing it? :)
I need to say that I'm a frontend developer, and my C# skills are very, very limited, that's why I'd like to know if I'm doing it the right way :)
when I try to call this method from XSLT it is failing to load and I am not able to see why is it failing also. I think there is some problem with namespace, I mean ConfigurationManager namespace, how it will be known here? Is there something I am missing
To all of you who come across this post, my assumption was very wrong and you should look at the answer provided by Chriztian. Please give him a hight five so others more easily can use some logical sense to figure out, which one is the correct solution.
Best way of getting value from web.config in XSLT
Hi folks!
I'm quite interested in the best way of getting a value from the web.config when working in XSLT.
Let's say that I have the following value in my web.config.
This could be a nodeId of some sort.
I have made a small xslt-extension that looks like this:
And I can then use it in my XSLT like this:
The above code gives me the right value, 1234, from the web.config, so actually the extension works like I hoped. But is this the easiest/fastest/most wicked way of doing it? :)
I need to say that I'm a frontend developer, and my C# skills are very, very limited, that's why I'd like to know if I'm doing it the right way :)
/Kim A
I guess it is...
I really don't think you can access a web.config file using XSLT...:-)
And why would you do that? You just created at nice extension to achieve your goal. #H5YR
/Jan
Thanks for your inputs guys. I guess I'm doing "the right way" then :)
Just wanted to know if there was any kind of "undocumented feature" for doing this. Thanks!
/Kim A
Hi Kim Andersen,
Can you help me to implement the same functionality. I tried in similar way but I think something is missing in my implementation.
<
msxsl:scriptlanguage="vbscript"implements-prefix="iis"
>
function hasFunction1(key)
hasFunction1=ConfigurationManager.AppSettings["TestConfig"]
End Function
</script>
when I try to call this method from XSLT it is failing to load and I am not able to see why is it failing also. I think there is some problem with namespace, I mean ConfigurationManager namespace, how it will be known here? Is there something I am missing
Hi there Raghunath
Sorry to say, but I don't know how to code vbscript :(
Can't you use some of the C# code provided above or do you have to use vbscript?
/Kim A
Hi all,
Just saw this one pop up - just wanted to chip in with a clean XSLT solution :-)
- lets say you need to know the Umbraco version:
Ahh, cool Chriztian. I didn't know that you could do it like that.
Thanks for the tip :)
/Kim A
To all of you who come across this post, my assumption was very wrong and you should look at the answer provided by Chriztian. Please give him a hight five so others more easily can use some logical sense to figure out, which one is the correct solution.
/Jan
is working on a reply...