Wednesday, March 28, 2012
Text editor?
Another good specll checker, free: http://www.netjs.com/speller/
Monday, March 26, 2012
Text files, reading,writing and saving
Hi,
I want a textbox on my site, you write in it and click save
the text is then saved as 'sample.txt'
then I also want that page to OPEN 'sample.txt' and read the contents into a textbox
I just want the simplest way of doing this
can someone point me at the code
thanks
Seethis tutorial which does what you ask.yes, that answered it
thanks!
AHHH... looks like the right code however...
got a couple of textboxes and buttons
I pasted this code from the tutor into the code area of a button
System.IO.StreamReader StreamReader1=new System.IO.StreamReader(Server.MapPath("test.txt"));TextBox2.Text= StreamReader1.ReadToEnd();StreamReader1.Close();it says: streamreader is a type in IO and cannot be used as an expression
it also says streamreader is not declared.
im using basic not C is that the problem?
Yes, the tutorial is in C#, not VB. For a VB tutorial trythis page.
yes the code example is written in C
however im using basic
visual web developer express
anyone know how to read write and save a file ...simply
it seems as though I can't use streamreader...there is no help on it in web developer express.
thanks for your help.
To read.. there's a great new addition to the System.IO namespace and that's "ReadAllText"
So you'd say
Text1.Text = System.IO.File.ReadAllText(Server.MapPath("~/sample.txt"))
and that's it!
For writing, the above links that everyone else is fine... 3 lines using the StringWriter class... and never ever forget to ".Dispose" the object otherwise it will lock the file
You've probably worked this out by now , but I wrote a little tutorial the other day that does exactly this, it over here if you're still intrestedwww.codeproject.com
Text Formating control Asp.Net
Just wondering if someone can help me.
Im writing a asp.net application for a friend and i need to be able to
fomat the text of the description field. ie. bold and bullet points etc
to the text using html tags.
Then when i write the text to page i will get formatted text.
does anyone know of a way or control to do this. I want to let the user
format the text so they can make the document more pleasing ton the
eye.
Thanks in advance
colincheck out:
http://www.freetextbox.com
awesome free tool
"csgraham74" <csgraham74@.hotmail.com> wrote in message
news:1125053490.859035.57720@.o13g2000cwo.googlegroups.com...
> Hi Guys,
> Just wondering if someone can help me.
> Im writing a asp.net application for a friend and i need to be able to
> fomat the text of the description field. ie. bold and bullet points etc
> to the text using html tags.
> Then when i write the text to page i will get formatted text.
> does anyone know of a way or control to do this. I want to let the user
> format the text so they can make the document more pleasing ton the
> eye.
> Thanks in advance
> colin
>
Another free one http://www.fckeditor.net/
this got an asp.net web control and support server side coding.. very
easy to config
Text Formating control Asp.Net
Just wondering if someone can help me.
Im writing a asp.net application for a friend and i need to be able to
fomat the text of the description field. ie. bold and bullet points etc
to the text using html tags.
Then when i write the text to page i will get formatted text.
does anyone know of a way or control to do this. I want to let the user
format the text so they can make the document more pleasing ton the
eye.
Thanks in advance
colincheck out:
http://www.freetextbox.com
awesome free tool
"csgraham74" <csgraham74@.hotmail.com> wrote in message
news:1125053490.859035.57720@.o13g2000cwo.googlegro ups.com...
> Hi Guys,
> Just wondering if someone can help me.
> Im writing a asp.net application for a friend and i need to be able to
> fomat the text of the description field. ie. bold and bullet points etc
> to the text using html tags.
> Then when i write the text to page i will get formatted text.
> does anyone know of a way or control to do this. I want to let the user
> format the text so they can make the document more pleasing ton the
> eye.
> Thanks in advance
> colin
Another free one http://www.fckeditor.net/
this got an asp.net web control and support server side coding.. very
easy to config
Saturday, March 24, 2012
Text Structure
I am in the middle of writing a form which takes a description of a product and saves it to a memo field in Access. However if this description has two or more paragraphs before it is saved to the databse, when it comes out again, it has lost the paragraphs and is just one lump of text.
Does anyone know how you go about retaining the structure of the text? Does the code have to check for paragrapgh and instert the <p> tags?
Thank you in davance for any tip you may have.You can do two things, put the paragraph in an asp:textbox / textarea, or surround the paragraph with <pre></pre>, which tells the browser not to mess with the formatting.
Thanks Michael your help is much appreciated.
Simple when you know how!
Hi,
You may use strMemo.Replace( Environment.NewLine, "<br>" )
Thursday, March 22, 2012
text writing security worries
I'm writing an application to load, edit and save xml with a flash7 front-end using .net scripts to write the xml.
Here's the script I'm using to save the xml:
private void Page_Load(object sender, System.EventArgs e){
String fileUrl;
String xmlData;
String returnToFlash;
fileUrl = Request.Form["fileUrl"];
xmlData = Request.Form["xmlData"];
StreamWriter sr = File.CreateText(Server.MapPath(fileUrl));
sr.WriteLine(xmlData);
sr.Close();
returnToFlash = "data=Success";
Response.Write(returnToFlash);
}
It's pretty simple, which is why I'm worried about the possibility of people 'spoofing' it with false data that hasn't come from my flash app.
There is a login script too which will (eventually) check the user credentials against a database to allow access. I was thinking that perhaps I should send these login credentials when saving a file to authenticate the user. Although I'm pretty sure there must be a better way to do it - ideally I don't want users to poll the database more than once per session.
This must be a problem that flash developers face all the time, I just haven't been able to find any articles on the topic (as I don't fully understand what I'm looking for!)
So my question is: What is the best way to secure access to this script without sending a username and password to check a database?
ThanksIt's a scary proposition when you are going to allow files to be uploaded to a web server. You should develop a strategy that allows you to upload files to a directory that only has Write permissions for the ASPNET/Network Service account as you want to prevent anyone from uploading an executable and being able to execute it.
That said, there is alot to security and this situation. I recommend you check out "Improving Web Application Security" and "Building Secure ASP.NET Applications".
I didn't consider the ASPNET/Network Service account permissions. They have already been set for me by hosting company for the directory I'm writing to. Perhaps this is enough?
Thanks for the links, I'll give them a read.
text/plain ContentType
Here's what I'm doing:
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()
What happens is that I did an open/save dialog.
If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.
Anyway that I can actually get this to open in the browser?May be your IIS is writing out a header for caching.
Sekhar.
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> I'm writing an ASPX page to open a .txt file, and display it in the
browser.
> Here's what I'm doing:
> Response.ClearContent()
> Response.ClearHeaders()
> Response.ContentType = "text/plain"
> Response.WriteFile(sExportPath)
> Response.Flush()
> Response.Close()
> What happens is that I did an open/save dialog.
> If I choose Save, it wants to save the file as MyASPXPageName.aspx
> and if I choose open, it opens the .aspx file which contains text.
> Anyway that I can actually get this to open in the browser?
My page is building the response, and unless I add something manually to the
header, such as
Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"
the file should open automatically in the browser. It works fine for PDF
files...
"Chandra Sekhar" <Chandra.Shekhar@.am.joneslanglasalle.com> wrote in message
news:e23snIKfEHA.2848@.TK2MSFTNGP10.phx.gbl...
> May be your IIS is writing out a header for caching.
> Sekhar.
>
> "George Durzi" <gdurzi@.hotmail.com> wrote in message
> news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> > I'm writing an ASPX page to open a .txt file, and display it in the
> browser.
> > Here's what I'm doing:
> > Response.ClearContent()
> > Response.ClearHeaders()
> > Response.ContentType = "text/plain"
> > Response.WriteFile(sExportPath)
> > Response.Flush()
> > Response.Close()
> > What happens is that I did an open/save dialog.
> > If I choose Save, it wants to save the file as MyASPXPageName.aspx
> > and if I choose open, it opens the .aspx file which contains text.
> > Anyway that I can actually get this to open in the browser?
text/plain ContentType
Here's what I'm doing:
Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "text/plain"
Response.WriteFile(sExportPath)
Response.Flush()
Response.Close()
What happens is that I did an open/save dialog.
If I choose Save, it wants to save the file as MyASPXPageName.aspx
and if I choose open, it opens the .aspx file which contains text.
Anyway that I can actually get this to open in the browser?May be your IIS is writing out a header for caching.
Sekhar.
"George Durzi" <gdurzi@.hotmail.com> wrote in message
news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> I'm writing an ASPX page to open a .txt file, and display it in the
browser.
> Here's what I'm doing:
> Response.ClearContent()
> Response.ClearHeaders()
> Response.ContentType = "text/plain"
> Response.WriteFile(sExportPath)
> Response.Flush()
> Response.Close()
> What happens is that I did an open/save dialog.
> If I choose Save, it wants to save the file as MyASPXPageName.aspx
> and if I choose open, it opens the .aspx file which contains text.
> Anyway that I can actually get this to open in the browser?
>
My page is building the response, and unless I add something manually to the
header, such as
Response.AddHeader "content-disposition", "attachment; filename=""" &
fileName & """"
the file should open automatically in the browser. It works fine for PDF
files...
"Chandra Sekhar" <Chandra.Shekhar@.am.joneslanglasalle.com> wrote in message
news:e23snIKfEHA.2848@.TK2MSFTNGP10.phx.gbl...
> May be your IIS is writing out a header for caching.
> Sekhar.
>
> "George Durzi" <gdurzi@.hotmail.com> wrote in message
> news:uYb$u1JfEHA.712@.TK2MSFTNGP09.phx.gbl...
> browser.
>