Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UrlRegistry.UrlFor(object) returning empty string for the home route #193

Closed
KevM opened this issue Nov 18, 2011 · 1 comment
Closed

UrlRegistry.UrlFor(object) returning empty string for the home route #193

KevM opened this issue Nov 18, 2011 · 1 comment

Comments

@KevM
Copy link
Contributor

KevM commented Nov 18, 2011

Created a brand new fubu web app using the spark view engine.

Set up my home route:

Routes.HomeIs<HomeRequest>();

In spark create a link to the home route

<a class="brand" href="${this.Urls.UrlFor(new WebApplication3.Home.HomeRequest())}">Test Brand</a>

Resulting Html is :

<a class="brand" href="">Test Brand</a>

The link here is empty. #sadtrombone

Wondering if this is related to issue #192

@KevM
Copy link
Contributor Author

KevM commented Nov 18, 2011

My guess is that AspNetCurrentHttpRequest.ToFullUrl(string) should not be trimming the ending slash when that is the only part of the url remaining.

        public string ToFullUrl(string url)
        {
            if (Uri.IsWellFormedUriString(url, UriKind.Absolute)) return url;
            if (url.IsEmpty())
            {
                url = "~/";
            }
            else
            {
                url = "~/" + url.TrimStart('/');
            }

            var absoluteUrl = VirtualPathUtility.ToAbsolute(url);

            return (absoluteUrl != "/") ? absoluteUrl.TrimEnd('/') : absoluteUrl;
        }

Working on a pull request

KevM added a commit to KevM/fubumvc that referenced this issue Nov 18, 2011
jeremydmiller added a commit that referenced this issue Nov 18, 2011
Fix for Issue #193 - don't trim a url's trailing slash if it is only a slash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants