Context.Request.ApplicationPath coming up empty?

J

Jim Corey

I've seen this same sort of code (below) on other posts. This works fine
for me on my development machine, but not when I move it to my hosted site.

When I view the source from my machine, I see:
src='/MyProjectFolder/Javascript/datepicker.js'
On the hosted site I get:
src='//Javascript/datepicker.js'
and it doesn't work.

Any ideas on what I can do to make the same code work both places?

Dim strScriptSrc As String
Dim strScriptBlock As String
If Not Page.IsClientScriptBlockRegistered("datepicker") Then
strScriptSrc = Context.Request.ApplicationPath +
"/Javascript/datepicker.js"
strScriptSrc = "/Javascript/datepicker.js"
strScriptBlock = "<script type='text/javascript' src='" +
strScriptSrc + "'></script>"

Page.RegisterClientScriptBlock("datepicker",strScriptBlock)
End If


--Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top