473,396 Members | 2,147 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Server variables in ASP.NET Html code

Given i have some control which has an "ImageURL" property. If this property
is set, then the HTML code for the web control looks something like:

<mns:image id=MyImg runat=server ImageURL="images/somepath.jpg"></mns:image>

Given i have some server variable Session("AppRoot") which declares the full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"

Now is there any way i can put the AppRoot variable directly into the HTML
control for the mns:image control, rather than having to put code in the .vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL

Could i somehow do SOMEthing like:

<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:image>
Nov 18 '05 #1
4 1647
There are a number of things I don't understand.

1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own
that inherits from this one.

2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?

3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"

4-
The answer to your question is no..but the solution in #1 will solve her
right up.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Given i have some control which has an "ImageURL" property. If this property is set, then the HTML code for the web control looks something like:

<mns:image id=MyImg runat=server ImageURL="images/somepath.jpg"></mns:image>
Given i have some server variable Session("AppRoot") which declares the full path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"

Now is there any way i can put the AppRoot variable directly into the HTML
control for the mns:image control, rather than having to put code in the ..vb file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL

Could i somehow do SOMEthing like:

<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:image>

Nov 18 '05 #2
Well, i cannot code it into the code for the control, because the control is
made in a separate library meant ot be generic to NO app in specific.

I cannot use a Root path ("/" or "~") because the app does not root at the
root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com

Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.

"Karl" <none> wrote in message news:e$**************@tk2msftngp13.phx.gbl...
There are a number of things I don't understand.

1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own
that inherits from this one.

2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?

3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"

4-
The answer to your question is no..but the solution in #1 will solve her
right up.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Given i have some control which has an "ImageURL" property. If this

property
is set, then the HTML code for the web control looks something like:

<mns:image id=MyImg runat=server

ImageURL="images/somepath.jpg"></mns:image>

Given i have some server variable Session("AppRoot") which declares the

full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"

Now is there any way i can put the AppRoot variable directly into the HTML control for the mns:image control, rather than having to put code in the

.vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL

Could i somehow do SOMEthing like:

<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:image>


Nov 18 '05 #3
~ uses the virtual app..so it should be ~ should be equal to /myapp

and you could still make the code generic to no specific app (as it is now
actually, it's specific to apps at the root level so it isn't very
generic)...but ~ should do the trick.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
Well, i cannot code it into the code for the control, because the control is made in a separate library meant ot be generic to NO app in specific.

I cannot use a Root path ("/" or "~") because the app does not root at the
root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com

Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.

"Karl" <none> wrote in message

news:e$**************@tk2msftngp13.phx.gbl...
There are a number of things I don't understand.

1-
If this is your own server control, or you have access to the source, why
not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the
class before the render? This way you don't have to worry about doing it
either at the page level or the codebehind. If you don't write your own that inherits from this one.

2-
Does the AppRoot actually belong to the sesssion? it's specific to each
user?

3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"

4-
The answer to your question is no..but the solution in #1 will solve her
right up.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
Given i have some control which has an "ImageURL" property. If this

property
is set, then the HTML code for the web control looks something like:

<mns:image id=MyImg runat=server

ImageURL="images/somepath.jpg"></mns:image>

Given i have some server variable Session("AppRoot") which declares
the full
path to the root of the application, for example
Session("AppRoot") = "http://www.someserver.com/myapp/"

Now is there any way i can put the AppRoot variable directly into the HTML control for the mns:image control, rather than having to put code in

the .vb
file to do something like
MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL

Could i somehow do SOMEthing like:

<mns:image id=MyImg runat=server
ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
</mns:image>



Nov 18 '05 #4
Hmm, .. well, i tried using the ~ instead and taking out my code in .vb to
prepend the approot to the path, but it does not work with the ~.

Thanks though for the idea.
"Karl" <none> wrote in message news:OK**************@TK2MSFTNGP10.phx.gbl...
~ uses the virtual app..so it should be ~ should be equal to /myapp

and you could still make the code generic to no specific app (as it is now
actually, it's specific to apps at the root level so it isn't very
generic)...but ~ should do the trick.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:eq**************@TK2MSFTNGP12.phx.gbl...
Well, i cannot code it into the code for the control, because the control
is
made in a separate library meant ot be generic to NO app in specific.

I cannot use a Root path ("/" or "~") because the app does not root at the root of the site.
The site's root is www.myserver.com/myapp, not www.myserver.com

Otherwise then i guess im just stuck having to alter the urls in the .vb
file then. Thats a little annoying. Itd be nice if you could somehow use
something like the databinding stuff to put out a server variable into
ASP.NET html code.

"Karl" <none> wrote in message

news:e$**************@tk2msftngp13.phx.gbl... There are a number of things I don't understand.

1-
If this is your own server control, or you have access to the source, why not simply put the code ImageUrl = Session("AppRoot") & ImageUrl in the class before the render? This way you don't have to worry about doing it either at the page level or the codebehind. If you don't write your own that inherits from this one.

2-
Does the AppRoot actually belong to the sesssion? it's specific to each user?

3-
You can simply use ~ to denote the application root, ala:
ImageUrl="~/images/somepath.jpg"

4-
The answer to your question is no..but the solution in #1 will solve her right up.

Karl

"A Traveler" <hi*********************@yahoo.com> wrote in message
news:u8**************@TK2MSFTNGP09.phx.gbl...
> Given i have some control which has an "ImageURL" property. If this
property
> is set, then the HTML code for the web control looks something like:
>
> <mns:image id=MyImg runat=server
ImageURL="images/somepath.jpg"></mns:image>
>
> Given i have some server variable Session("AppRoot") which declares the full
> path to the root of the application, for example
> Session("AppRoot") = "http://www.someserver.com/myapp/"
>
> Now is there any way i can put the AppRoot variable directly into
the
HTML
> control for the mns:image control, rather than having to put code in

the .vb
> file to do something like
> MyImg.ImageURL = Session("AppRoot") & MyImg.ImageURL
>
> Could i somehow do SOMEthing like:
>
> <mns:image id=MyImg runat=server
> ImageURL='<%# Session("AppRoot")%>images/somepath.jpg'>
> </mns:image>
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Jeager | last post by:
Why is it, Microsoft manage to write operating systems and office applications with every bell and whistle facility known to man. Yet, even after years and years of development they still cannot...
5
by: Phil Grimpo | last post by:
I have a very odd situation here. I have an administration page, where based on a users permissions, a recordset is called from the SQL server which has a list of paths to "Module Menus". Each of...
4
by: Phil Grimpo | last post by:
I had previously explained this problem in a different thread, but now that I have an IISState log, I figured I'd re-start the thred. My situation and the log are following... I have a very odd...
6
by: StephenMcC | last post by:
Hi All, Got a quick query in relation to the Server.Transfer method available in IIS 5+/ASP. I've got an issue where I want to take a portion of an online app and extract this out into a web...
1
by: oreng | last post by:
Hey all, I have some problems detecting whether the client's browser javascript is enabled at the server side. While Request.Browser.JavaScript only check if the browser enable java script (and...
37
by: John Salerno | last post by:
I contacted my domain host about how Python is implemented on their server, and got this response: ------------------- Hello John, Please be informed that the implementation of python in our...
2
by: Jobs | last post by:
Download the JAVA , .NET and SQL Server interview with answers Download the JAVA , .NET and SQL Server interview sheet and rate yourself. This will help you judge yourself are you really worth of...
1
by: Shashank | last post by:
Hi all, I am a new member of this community. I am making a http request to a html file placed on a Apache server. On this page there is an embeded perl statement which requires reading ...
3
by: vunet.us | last post by:
Hello, I am breaking my head running out of ideas about the best solution to my goal. I want to load some pages generated with the server (ASP) and assign their html results to JavaScript, so...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.