Context.Request.ApplicationPath coming up empty?

  • Thread starter Thread starter Jim Corey
  • Start date Start date
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
 
Back
Top