Problems Accessing HttpContext.Current.Profile in Custom Rewrite-Rule-Provider

79 views
Skip to first unread message

Gavin

unread,
Dec 19, 2007, 4:57:10 PM12/19/07
to UrlRewritingNet
Hi,

Does anyone know how to access HttpContext.Current.Profile in
RewriteUrl of a custom rewrite-rule-provider?

I'm trying to redirect based on the language choice of the current
profile but always get a "Object reference not set to an instance of
an object" error when accessing HttpContext.Current.Profile.

I guess ASP.NET hasn't populated HttpContext.Current.Profile by this
point in the page life cycle yet(?) even though
HttpContext.Current.Request is available. Is there any way to force
ASP.NET to populate the object?

In case it bears any relevance - I'm also using the
SqlTableProfileProvider that's commonly used to store profile
information in a normalised format.

Thanks in advance for any help in this matter,
Gavin.

Albert Weinert

unread,
Dec 19, 2007, 6:35:43 PM12/19/07
to UrlRewr...@googlegroups.com
Don't know about the Profile. I think (as you) the rewriting happens some steps before the profile information was retrieved.

But i recommend you to put the language information in the url, so that also search engines can get all languages and not only the default language.

________________________________

winmail.dat

Gavin

unread,
Dec 19, 2007, 8:02:39 PM12/19/07
to UrlRewritingNet
Hi Albert,

That's exactly what I'm trying to do for SEO with an old site, hence
the question ;)
Reply all
Reply to author
Forward
0 new messages