To get the current Url without the query in VB.NET [code lang=”vb”]Request.Url.AbsoluteUri.Split("?")(0)[/code]
Category: VB.NET
Split text in two columns in VB.NET
This is a function code snippet to split a text in to two or more columns in VB.NET. It is converted from my previous posted: Split text into multiple columns in PHP Parameters: InputString – String to be split into columns Columns – Number of columns SplitString – String to look for to not split… Continue reading Split text in two columns in VB.NET
.NET Client Side Field Validation not working
This was driving me nuts earlier today, so this post is a kind of reminder to myself not to forget this again: When using Routing in .NET 4 always remember to add exceptions for axd files! Example: [code]routes.Ignore("{resource}.axd/{*pathInfo}")[/code] In my case I could not get standard .Net Field Validation to work client side. It was… Continue reading .NET Client Side Field Validation not working
How to remove characters to avoid .NET Request Validation Error (A potentially dangerous Request.Path value was detected from the client)
In .NET Framework 4 url checking – request validation – is different from .Net 2.0. This is the error you will see when you hit this: Server Error in ‘/’ Application. A potentially dangerous Request.Path value was detected from the client Description: An unhandled exception occurred during the execution of the current web request. Please… Continue reading How to remove characters to avoid .NET Request Validation Error (A potentially dangerous Request.Path value was detected from the client)
ASP.NET Routing gives 404 error
I really like the new .NET 4 (3.5) routing, it is very simple and straight forward to implement – just add some MapPageRoute to your global.asax and then some RouteData.Values to your aspx files 🙂 Anyway it was simple until last night when I was adding routing to an old VB.NET WebSite project. I just… Continue reading ASP.NET Routing gives 404 error
ASP.NET 4.0 Chart Control Problems on IIS7
I have been playing around with the ASP.NET 4.0 Chart Controls for a new web site (Bilvärdet.se – used car price statistics) When deploying it to IIS7 on my Windows Server 2008 I ran in to a few problems: 1) I did not have .NET 4.0 Framework installed on the server 🙂 It turns out… Continue reading ASP.NET 4.0 Chart Control Problems on IIS7
BC30560: ‘MySqlConnection’ is ambiguous in the namespace ‘MySql.Data.MySqlClient’.
I got this error in one of my ASP.NET web sites after uploading a new version: BC30560: ‘MySqlConnection’ is ambiguous in the namespace ‘MySql.Data.MySqlClient’. It worked fine on my development machine but not on the production server. I could not figure out what it was for quite some time. Turned out I had added the… Continue reading BC30560: ‘MySqlConnection’ is ambiguous in the namespace ‘MySql.Data.MySqlClient’.
Convert Accented Characters to ASCII
It is pretty simple in .NET to convert Western Unicode (non-ASCII, accented, diacritics) to ASCII, but regardless I had a hard time figuring it out it so I’m posting here for my own future reference. [code lang=”vb”] Dim strTest as String = "Any string containing accented characters, e.g. åäöéèêÅÄÖÉÈÊ" strTest = System.Text.Encoding.ASCII.GetString(System.Text.Encoding.GetEncoding(1251).GetBytes(strTest)) [/code]
Punycode in VB.NET for IDN domains
On one of my web sites I noticed that IDN (Internationalized Domain Names) don’t work when I do Response.Redirect in VB.NET. IDNs are used to allow accented and other special international characters (non-Ascii) to be used in domain names. Since Domain Name Servers (DNS) only support Ascii, any IDN is encoded in Punycode. To encode… Continue reading Punycode in VB.NET for IDN domains