asp.net-3.5

Getting a Return Value in C# asp.net from a stored procedure (syntax issue)

混江龙づ霸主 提交于 2019-11-27 02:25:13
问题 I am having issues trying to get the syntax correct for my C# 2008 asp.net code. I need to get a return value (Select @@Identity) from my stored procedure My C# code is: SqlConnection conn = new SqlConnection(strConn); string sql = "usp_ClientProfile_Header"; SqlCommand cmdHeader = new SqlCommand(sql, conn); cmdHeader.CommandType = CommandType.StoredProcedure; cmdHeader.Parameters.Add(new SqlParameter("@FirstName", SqlDbType.VarChar, 50)); cmdHeader.Parameters["@FName"].Value = txtFName.Text

Convert a string to a datetime

左心房为你撑大大i 提交于 2019-11-27 01:44:53
I am developing asp.net site using vb framework 3.5 . Im having difficulties converting string data into Date I tried using cdate function, I have a variable sdate which is a string variable and date is stored in it which comes from textbox as dd/mm/yyyy now i want to convert this string into a Date variable as i need to perform the operations as Add a day or Subtract a day. Please guide me how to go about this. i get the error on 3rd line as, String was not recognized as a valid DateTime . I have tried to do as follows but the error comes Dim sdate As String Dim expenddt As Date expenddt =

Making user login persistant with ASP .Net Membership

て烟熏妆下的殇ゞ 提交于 2019-11-27 01:21:22
问题 I have a website that is built in ASP.NET 3.5 & SQL Server 2005, using the sql membership provider, and presumably forms authentication. Since security needs on my site are very low, I would like to authenticate once, and then keep the log in persisted indefinitely (without giving the user the choice). What is happening is that the user logs in, stays logged in for the session, and then the next time they arrive, they are logged out. How can I get the log-in persisted? Here's the technical

creating a user in Active Directory: A device attached to the system is not functioning

為{幸葍}努か 提交于 2019-11-27 00:34:07
问题 Consider this code attempting to create an Active Directory account. It's generating an exception here with a certain set of data. It's not clear right now what's causing the exception. var user = new UserPrincipal(someValidUserContext, ".x-xyz-t-FooFooBarTest", "somePwd", true); user.UserPrincipalName = ".x-xyz-t-FooFooBarTest@foobarbatbaz.net"; user.SamAccountName = ".x-xyz-t-FooFooBarTest"; user.DisplayName = "Some String 16 chars long"; user.Name = "Some String 16 chars long"; user

Forms Authentication Timeout vs Session Timeout

只愿长相守 提交于 2019-11-26 12:03:09
In my asp.net website i am using asp.net form authentication with following configuration <authentication mode="Forms"> <forms loginUrl="~/Pages/Common/Login.aspx" defaultUrl="~/Pages/index.aspx" protection="All" timeout="30" name="MyAuthCookie" path="/" requireSSL="false" cookieless="UseDeviceProfile" enableCrossAppRedirects="false" > </forms> </authentication> I have following questions What should be timeout value for session because i am using sliding expiration inside form authention due to which session will expire before form authentication. How can i protect it? After

Stopping onclick from firing when onclientclick is false?

北慕城南 提交于 2019-11-26 11:25:08
问题 Is it possible to use the onclientclick property of a button to do a clientside check. If the check returns true , then fire the onclick event. If the clientside check returns false , don\'t fire the onclick event. Is that possible? UPDATE: These 2 work: Stops the form from submitting: OnClientClick=\"return false;\" Allows the form to submit: OnClientClick=\"return true;\" The next 2 do not work: // in js script tag function mycheck() { return false; } // in asp:button tag OnClientClick=\

Unable to convert MySQL date/time value to System.DateTime

廉价感情. 提交于 2019-11-26 10:34:03
问题 I get this error: Unable to convert MySQL date/time value to System.DateTime while I am trying to fetch the data from a MySQL database. I have the date datatype in my MySQL database. But while retrieving it into my datatable, it get the error above. How can I fix this? 回答1: If I google for "Unable to convert MySQL date/time value to System.DateTime" I see numerous references to a problem accessing MySQL from Visual Studio. Is that your context? One solution suggested is: This is not a bug but

Convert a string to a datetime

馋奶兔 提交于 2019-11-26 07:41:42
问题 I am developing asp.net site using vb framework 3.5 . Im having difficulties converting string data into Date I tried using cdate function, I have a variable sdate which is a string variable and date is stored in it which comes from textbox as dd/mm/yyyy now i want to convert this string into a Date variable as i need to perform the operations as Add a day or Subtract a day. Please guide me how to go about this. i get the error on 3rd line as, String was not recognized as a valid DateTime . I

How can I deserialize JSON to a simple Dictionary<string,string> in ASP.NET?

旧巷老猫 提交于 2019-11-25 22:18:30
问题 I have a simple key/value list in JSON being sent back to ASP.NET via POST. Example: { \"key1\": \"value1\", \"key2\": \"value2\"} I AM NOT TRYING TO DESERIALIZE INTO STRONGLY-TYPED .NET OBJECTS I simply need a plain old Dictionary(Of String, String) , or some equivalent (hash table, Dictionary(Of String, Object), old-school StringDictionary--hell, a 2-D array of strings would work for me. I can use anything available in ASP.NET 3.5, as well as the popular Json.NET (which I\'m already using