Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8222285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T14:13:29+00:00 2026-06-07T14:13:29+00:00

To get fully qualified path of application I have wrote a function: public class

  • 0

To get fully qualified path of application I have wrote a function:

    public class Generic
    {
        public static string FullyQualifiedApplicationPath
        {
            get
            {
                //Return variable declaration
                string appPath = string.Empty;

                //Getting the current context of HTTP request
                var context = HttpContext.Current;

                //Checking the current context content
                if (context != null)
                {
                    //Formatting the fully qualified website url/name
                    appPath = string.Format("{0}://{1}{2}{3}",
                                            context.Request.Url.Scheme,
                                            context.Request.Url.Host,
                                            context.Request.Url.Port == 80
                                                ? string.Empty
                                                : ":" + context.Request.Url.Port,
                                            context.Request.ApplicationPath);
                }

                if (appPath.EndsWith("/"))
                    appPath = appPath.Substring(0, appPath.Length - 1);

                return appPath;
            }
        }

    }

when I use it in <head> tag between <%=%> I am getting different outputs.

<link href="<%= Generic.FullyQualifiedApplicationPath %>/Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
<script src="<%= Generic.FullyQualifiedApplicationPath %>/Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>

html output:

<link href="&lt;%= Generic.FullyQualifiedApplicationPath %>/Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
<script src="http://localhost:2093/SourceOne/Scripts/jquery-1.7.2.min.js" type="text/javascript"></script>

just wandering why asp.net engine sends &lt;%= Generic.FullyQualifiedApplicationPath %> to client.

–NJ

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T14:13:31+00:00Added an answer on June 7, 2026 at 2:13 pm

    ASP.NET basically treated your inline evaluation as string literal and escaped it. You may try using Databinding syntax <%# %>

    <link runat="server" id="lnkStyle" href='<%# Generic.FullyQualifiedApplicationPath   + "/Styles/StyleSheet.css"%>' rel="stylesheet" type="text/css" />
    <script runat="server" id="scptJQuery" src='<%# Generic.FullyQualifiedApplicationPath + "/Scripts/jquery-1.7.2.min.js"%>' type="text/javascript"></script>
    

    then in your code behind, override OnPreRender, and put in the following logic

    lnkStyle.DataBind();
    scptJQuery.DataBind();
    

    It is important that the binding syntax is not mixed with other literals, or ASP.NET would treat the whole attribute as string literal.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to get the fully qualified root URI of an application without
Scenario is I have a application relative url like ~/path/to/page.aspx?query=string. I need to programatically
How to get a fully qualified path to MS Explorer in .NET? The path
You can get the fully qualified class name of a Python object like this
I have a web service that requires a two part query to fully get
Possible Duplicate: What are the reasons why Map.get(Object key) is not (fully) generic According
For logging purposes I want to retrieve the fully qualified class name of a
I am trying to get the NetBios name from a fully qualified Domain Name...
I'd like to get the fully qualified method name. I can see how to
In a C project (POSIX), how do I get the fully qualified name for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.