As what other member said in this community, the data assign a public variable may be shared among users, therefore, how am be able to declare a property that will accept an array of values using List<string>? The variable will be use in about fifteen pages...if I am going to declare this on each of the page, this will result to difficulty in maintaining the code of my program.
I am trying to return some data as json from an action method.
I have an employee object that looks like this:
public class Employee { public int EmployeeID {get; set;} public string FirstName {get; set;} public string LastName {get; set;} //Other irrelevant properties }
Then I have a view model as follows
public Class EmployeeViewModel { public Employee Supervisor{get; set;} public List<EmployeeViewModel> Employees }
I need to return a json object that looks exactly like this:
For now I only need to go to the second level as above, returning and supervisor and their staff members beneath them.
How would I go about returning this in my action method(I have the viewModel object hydrated already I just need to return it as json). My problem so far has been that the children property does not get populated.
I created user control. It has string[] public property (it may be List<string> or whatever). I want to support defining this property in aspx code, when declaring the instance of this usercontrol. Something like this:
I'll use Customer and Addresses as an example rather than explain my real objects. Say I have a repeater bound to a collection of Customers and one of the properties of Customer is an array of addresses. How do I bind to the addresses property? I don't even need to display this information I just want to use it in the Repeaters ItemDataBound event. So I tried to bind a hiddenField to the addresses property but all I get for every customer in the hiddenfields value is an empty array of addresses.
The user control has public properties named accordingly and the page has protected properties accordingly which I've verified have the desired values.
For some reason the values are always empty strings or 0s in the usercontrol, no matter what the page property is.
I need to know what would be the best choice of array to use given the following specifications. This array's size will be predermined upon the loading of the appication. All I want to do is be able to add values to this array and replace preexisting array items with new values without the array changing size. Someone suggested that I use a Dictionary Array Object? I would appreciate any suggestions.
i'm using asp.net 3.5 and my site is hosted on godaddy i have a contact us form on the site. and i have to send the contact queries on [URL] which is hosted on godaddy. whenever i try sending mails i get this error
The transport failed to connect to the server.
Description:
An unhandled exception occurred during the execution of the current web request. review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Runtime.InteropServices.COMException: The transport failed to connect to the server.
Source Error:
[Code]....
Line 250: SmtpMail.SmtpServer = "smtpout.asia.secureserver.net"; Line 251: mailmsg.Priority = System.Web.Mail.MailPriority.Normal; Line 252: SmtpMail.Send(mailmsg); Line 253: } Line 254: }
i tried changing smtp to relay-hosting.secureserver.net aswell. but it didn't work. i'm using this method of my classfile's sendmail class public void SendMessage(string From, string ToEmail, string subject,string body)
I m having a database problem that I couldnt identify. The IIS loses connection to database once in 3 weeks. Once you restart the IIS everything is normal. Looks like IIS is fine because i can go to static pages. When I go to a page that requires database connection I get this error:
A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - Either the application has not called WSAStartup, or WSAStartup failed.
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
Is this a connection string problem?. because without changing anything if I restart the webserver all is fine. Is this a problem with application state?
I have situation where I need to authenticate a client across multiple web services. Basically each service needs to identify the client and know a few other small pieces of information about the client.
The way I have it working now is that the needed identifying information is stored in a session table in a database by the authenticating web server. The web server hands the client an string, which IDs the database entry and gets passed to the other web services. The web services then use this string to pull the needed information about the client from the database entry.
It has occurred to me that it might be possible to give the client an encrypted blob that contains the user ID and other needed information, which is rather small, and avoid using the database for this completely. The client would just pass around the blob (like the string in the previous paragraph) without needing to know what it contains, and only the web services would know how to decrypt it.
This should eliminate the need for the database to store the session information and would make the whole process a good bit simpler. With the database you have to worry about cleaning up old sessions and timeouts and so on.
So my question: is passing around sensitive data from service to service via client considered safe and acceptable? Is it possible to do this in a way that would eliminate worry about the client tampering with the data? What encryption algorithms would be good to use?
Iam getting an array of list from database to client side(javascript array). Now my aim to place those values in a div one by one and that div should attach to the textbox similar to Autocomplete extender.
i have a array in javascript and need to send to server how i can send it in jquery and get them in controller . to send javascript array and get them in controller [c#]
I am trying to insert a array into SQL with no luck. I get the string from a GPRS device that looks like this:
/WeightBridge.aspx?ReadeID=A1B5A0F5C4E4A1B5A0F5C4E4& agID=45B6C56A90B645B6C56A90B6,A47B1256A45F0843,B49B1256A45F08FF,30 SEP 2010 21:33:59,I,&Custom=Vehicle Num
All I want to do is to split the TagID array and insert it with the rest of the string into a SQL table. The TagID array must inserted into the following colomns in the DB. TagID, TID, UserMemory, DateTime and Direction. After the insert I just give a response that the insert was successfull or failed.
My code this far:
Imports System.Data.Sql Imports System.Data.SqlClient Partial Class WeightBridge Inherits System.Web.UI.Page
We have been experiencing a strange problem with emails being sent from our web server. We send out reminder emails once a month to our customers, it seems that not every one gets these emails. They have checked their spam folders etc and to no avail. Is there anything I can tweak on the server that may be causing certain people not to get the emails.
Via the button1_ click event I retrieve all files in a directory (Example Follows)
[Code]....
I now need to check whether this filename exists as a field in a SQL Server table. For example, if the directory retrieves a file named ExampleFile.txt which does not exist in the (Table = TableFileStore;s Field = FileRetrievals) then I want to insert the filename.
How do I construct a stored procedure to pass the filename(s) into a stored procedure as a parameter? Do I need to also create an array of filenames and pass the array into my stored procedure? Does the stored procedure belong within the foreach loop?
I need to send an array of strings to a stored procedure and then use that array of strings to create a filter of the data returned.for example I need need to send the following array to the strored procedure:
[Code]....
and use that array to run the fillowing sql command:
This code is working fine in my local system but when i upload it on server then it gives this error. From the last 1 year it was working fine but from last few days it gives me above said error, please suggest me is there any authentication required to send mail from server (my hosting plan is with 1and1.com)
i have an application i deployed to an hosting provider service. my mailing scripts sends out emails successfully using the smtp server address they gave me. but i recently move the application back to a server on our school LAN, using the same hosting service stmp address, i cant get any mail delivered to the intended reciepents. is it that i need to configure the smtp server on that machine (mayb IIS) & discard the host smtp server address, or i need to install some more mailing programs.
I receiving an error when sending email from an asp.net page on a hosted server. Below is the code and error;
MailAddress from = new MailAddress("email@home.com"); MailAddress to = new MailAddress('ToMe@something.com"); using (MailMessage message = new MailMessage(from,to)) message.Subject = "Something"; message.Body = "Something is the body"; [code]...