c#


Encode filename spacebars for browser (CS)


I have a button that starts uploading a filename that has Spaces.
Firefox fails to use this name, its OK for IE.
How to encode spaces to underlines with csharp?
The String.Replace(char, char) method, thus:
string filename = "This is an example";
string encodedFilename = filename.Replace(' ', '_');
Console.WriteLine(encodedFilename);
Produces "This_is_an_example".
Try this:
String safeFileName = fileName.Replace(" ", "_");

Related Links

How to get search results from Google with Java or C#?
Why can't non-verbatim strings contain newlines?
Window vs Page vs UserControl for WPF navigation?
KeyEventArgs event not working
Sending post data on Windows 8
Convert String to corresponding Forms.Keys value?
Convert Visual Basic (.net 1.1) project to C#
Send email from aspx page
Use view from other MVC project
C# recursive programming with lists
Change metro app background using a image from Uri
How to loop collections in LINQ and pass on data
C# - DataGridView - always display TopLeftHeaderCell
reflection with stacktrace / stackframe to get both methods name and parameters
Distance between two numbers in looping sequence [closed]
Back button disabling links in content placeholder?

Categories

HOME
gcc
redux
ftp
ms-application-insights
thermal-printer
confluence-rest-api
glympse
jshell
kendo-asp.net-mvc
hibernate-mapping
rethinkdb
segmentation-fault
cracking
angularjs-ng-repeat
guidewire
aiml
aws-devicefarm
passbook
cherrypy
rndis
wai-aria
devexpress-mvc
rancher
nsopenpanel
expressionengine
pydub
utc
sqldependency
jms-topic
mplab
loopback
machine-code
gitosis
cocoa-scripting
lighting
extern
rythm
stencyl
pyopenssl
ng-class
dcom
jscoverage
playframework-2.3
r-commander
opticalflow
bipartite
huawei
lattice
addressbook
alfred
git-push
virtualenvwrapper
class-design
disconnect
konakart
angularfire
sbt-proguard
web-optimization
firefox-os
containstable
askbot
taverna
dpkt
conkeror
qxorm
pysvn
crystal-reports-7
jsonschema2pojo
opencobol
node-amqp
xml-validation
thucydides
mencoder
static-class
nsnumber
http-compression
nsregularexpression
bindinglist
diazo
pinchzoom
scriptmanager
virtual-printer
youtube.net-api
nyromodal
google-local-search
browser-state
system-analysis
coderush-xpress
cons
office-2003
weak-typing
scalable

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App