Showing posts with label message. Show all posts
Showing posts with label message. Show all posts

Monday, March 26, 2012

Suggested means to cope with commas etc.

G'day,
In a typical 'contact us' type page what is a recommended way to ensure a message text box gets dealt with properly rather than break at comma's etc.

Is it as simple as using server.encodeHTML() on every passed variable? When I do this I still seem to have problems.

GeoffWhy would you break at commas? I don't get the problem.
Sorry. Error was happening when writing a record of the email to a database.

So if I can change my question...

Is there a best-practice' approach to handling commas etc. when writing to database eg:..."insert into myTable message = '" & server.encodeHTML(msg.text) & "'" is the sort of thing that was breaking if a comma existed in the textbox called msg?

Thanks,

Geoff
The commas should not mess it up within the quotes.

If an apostrophe appears within the string ('), then it will close the string and this is what will mess it up.

The best practice is to use Parameters. These will take care of all these issues as well as protect you against SQL injection and a few other problems you may not have noticed yet.

Suggestion/Reference/Idea on creating bulleting board by asp.net

Any one can give me some idea on how to start with creating a bulletin board for web site. A bulletin board which can display posted message and giving comments. Thanks on behalf

You may find many examples in the following links:

http://asp.net/ControlGallery/default.aspx?Category=34&tabindex=2

http://www.hotscripts.com/ASP.NET/Scripts_and_Controls/Discussion_Boards/index.html

Hope it helps.

Tuesday, March 13, 2012

Switch from ASPNET/NETWORK SERVICE Account

Hi,

I have a page which requests info from a number of machines and whenever I try to do this I get an 'access is denied' error message. How do I change the account that my page is using to one which actually has access to the machines.

Thanksthere is not really a straight-forward answer to this.

if all of these servers are on the same domain, then you will ba able to impersoninate a common user in the web.config ..

<identity impersonate="true" userName="domain_name\user" password="password"/
make sure this user has the appropiate permissions on all the folders your are trying to access.

by default, the ASP.NET Machine Account is used for all requests.

psi
thanks psi
see if the framework and/or the ASP.NET Machine Account is on all machines ... if it is, and all the servers are on the same domain, you should be able to set the service to network service ...

psi
Is there any other way I could do this? There is a single account on the domain that I can use but its password is changed frequently and it is a account which my boss would prefer not to have hard-coded into the web.config file.

Thanks again,
Tomas