Closed razmazn151101 closed 2 years ago
Hi, What kind of trouble?
i have converted it to vb using addhandler in my global.asax, but i am getting 404 error as i run it . Below are the code Sub Application_Start(sender As Object, e As EventArgs) ' Fires when the application is started RouteConfig.RegisterRoutes(RouteTable.Routes) BundleConfig.RegisterBundles(BundleTable.Bundles) i18n.UrlLocalizer.QuickUrlExclusionFilter = New System.Text.RegularExpressions.Regex("(?:sitemap.xml|.css|.jpg|.png|.svg|.woff|.woff2|.eot|.js|.html|.json)$|(?:elmah|bundles)")
i18n.LocalizedApplication.Current.PermanentRedirects = False
i18n.UrlLocalizer.UrlLocalizationScheme = i18n.UrlLocalizationScheme.Scheme2
i18n.UrlLocalizer.OutgoingUrlFilters = AddressOf addLanguange
i18n.LocalizedApplication.Current.DefaultLanguage = "my"
i18n.LocalizedApplication.Current.CookieName = "i18n_langtag"
End Sub
Function addLanguange(ByVal url As String, currentRequestUrl As Uri)
Dim uri As Uri
If Uri.TryCreate(url, UriKind.Absolute, uri) Or Uri.TryCreate(currentRequestUrl, url, uri) Then
If (url.StartsWith("?", StringComparison.OrdinalIgnoreCase)) Then
Return False
End If
End If
Return True
End Function
Are you saying it works if you don't add any OutgoingUrlFilters
delegate, but you get 404 when you add the delegate?
Ok already solve it thanks
Hi, i am having trouble to figure out conversion in vb.net in global.asax regading this code i18n.UrlLocalizer.OutgoingUrlFilters += delegate (string url, Uri currentRequestUrl) { Uri Uri; If (Uri.TryCreate(url, UriKind.Absolute, out uri) || Uri.TryCreate(currentRequestUrl, url, out uri)) { If (url.StartsWith("?", StringComparison.OrdinalIgnoreCase)) Then { Return False; } } Return True; };
Hope you could assist