I am using Login control and validationg the user against SQL datasource. below is the code:
Protected Sub Login1_Authenticate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.AuthenticateEventArgs) Handles Login1.Authenticate e.Authenticated = IsValidUser()If IsValidUser() = True Then Response.Redirect("Orders.aspx")End If End Sub Here is IsValidUser Private Function IsValidUser() As Boolean Try Dim sql As String = String.Empty Dim RecCount As Integer = 0 sql = "Select count(*) from UserLogins where UserName='" & clsDB.RemoveQuote(Me.Login1.UserName.Trim) & "'" sql = sql & " AND UserPass='" & Me.Login1.Password.Trim & "'" RecCount = clsDB.ExeScalar(sql) 'If Invalid ==> 0 means no record is being returned by Query If RecCount = 0 Then IsValidUser = False 'MessageBox.Show("Invalid User Name/Password.", "Invalid", MessageBoxButtons.OK, MessageBoxIcon.Stop) Exit Function End If If RecCount = 1 Then IsValidUser = True Exit Function End If 'Error handler Catch ex As Exception End Try End Function
Here comes the problem validation code is working fine and it validates the user and redirects the user to the "Order.aspx" page
For example: I type Login Name: Nashy Password: 1234
Order.aspx page has a textbox which supposed to display the current user login name and i am usiong the following code for that
when i test it on my local PC it shows the current user like this DOMAIN ashyMastrew.. what i want that the textbox should disply "nashy" not my current windows login name. and when i deploy it to the server and access it from other pc textbox does not show anything.
Have a simple Comments form syntax with CSS, so that  a person can leave his/her name, e-mail, subject and comments. the form that can write under the question when Reply is pressed by the person.
I'm trying to get the comments section for a user, to populate a text box which can be updated. I'm getting the "Object reference not set to an instance of an object" error. Why is this occurring?
hows the best way to display comments/user data from a db using mvc?do we just do our own for loop and manually display it or? will doing it this way cause paging problems in the future? any best methods or practice?
I have a form that contains a number of user controls (partial views, as in System.Web.Mvc.ViewUserControl), each with their own view models, and some of those user controls have nested user controls within them. I intended to reuse these user controls so I built up the form using a hierarchy in this way and pass the form a parent view model that contains all the user controls' view models within it.For example:
Parent Page (with form and ParentViewModel) -->ChildControl1 (uses ViewModel1 which is passed from ParentViewModel.ViewModel1 property) -->ChildControl2 (uses ViewModel2 which is passed from ParentViewModel.ViewModel2 property) -->ChildControl3 (uses ViewModel3 which is passed from ViewModel2.ViewModel3 property)
My question is how do I retrieve the view data when the form is submitted? It seems the view data cannot bind to the ParentViewModel:public string Save(ParentViewModel viewData)...
as viewData.ViewModel1 and viewData.ViewModel2 are always null. Is there a way I can perform a custom binding?
Ultimately I need the form to be able to cope with a dynamic number of user controls and perform an asynchronous submission without postback. I'll cross those bridges when I come to them but I mention it now so any answer won't preclude this functionality.
i want to build a user registration page where a user can submit his firtname,lastname contact address telephone,email and upload a passport size picture with a specific file size and if bigger than the said image size it will not upload to the database and to be able to retrive back all information submited with the form including the passport size photograph and view them in a given page. I have been trying my hands on it but i could not get it work.
I have a simple form written in asp.net/C# and when trying to hit enter while in the form's input box doesn't submit the form for some reason. I had implemented a fix for a previous bug where pressing enter would merely refresh the page without submitting the form data but now pressing enter just does nothing, the fix is below:
Im currently experincing some difficulties with a button refreshing the page even when there is no code in the button. Ill try and explain the best i can the situation but if anyone needs any further clarifaction then please ask, im not 100% sure which part of the forum to post this in so i hope this is the right one. Im making what is effectively an online file repoistory, and have the folders set up in the database as one table where each folder has a parent value. If the parent is a root it as a value of 0 otherwise it has the parent folders id. The root is created automattically for a user and they can not do anything with it other than add new folders or upload a file to it. When a user is using the application they start of viewing the contents of the root folder and can see all the files uploaded on the root in a grid view which populates itself using the "data source" smart tag. It knows which folder it should be looking at via a hidden value which is the folders id. The folder gird view is again populated via the smart tag option and again based on the folder currently being viewed folder id. The user can click on a button in the gird view to open one of the child folders via the row_command event handler. This changes the hidden value to the id of the child folder and the grid views change to reflect that it is now looking into that folder. This all works fine. The problem is click on a button to say add a new button, even when i removed the code from the button it still refreshs the page and goes back to viewing the root folder. Im self taught so dont really understand what goes on behind the scences to well but im guessing theres some reason to why it happening. If anybody could explain why this behaviour happens and any possible solutions to this problem.
Recently, I am working on the website where I am generating random number and storing it in database as the primary key. So, this key would be foreign key for many table, now how would I generate the random number and check if random number does not have duplication? Is there any function to check if number is not duplicate?
I have an updatepanel to which I am adding a web user control dynamically. This web user control has an AsyncFileUpload. I have read several articles that tell that asyncfileupload control will not work if added at run-time. As suggested by some of the articles,I tried adding a static asyncfileupload control but still it does not work.I need to have 5 file upload controls in the web user control. Do you think I can make them to work or should I completely do a re-design or go with full postbacks. My preference is to be able to use asyncfileupload control and I am willing to invest time in making them to work since they improve the user experience by many folds.
I need to construct a regular expression for the password textbox which shouldn't accept special characters($,@,!,etc).Even whitespaces,tabs. I tried the below this accepts special characters.
<asp:RegularExpressionValidator ID="RegEx" runat="server" ControlToValidate="Password" ErrorMessage="Password must be atleast 8 characters and include a number,alphabets upper case and lower case. "ToolTip="Password format is not correct" ValidationExpression="^(?=.{8})(?=.*d)(?=.*[a-z])(?=.*[A-Z]).*$"> </asp:RegularExpressionValidator>
I am working on a web application that is consuming a Dataset returned by a web service. As the application is running I store that Dataset as a session variable to be used over and over again as the user navigates to the different pages that will edit the tables within the dataset. The idea was the user will only have to wait for the data once when the application loads then the application would use the session variable until the user saves the changes they made, when that happens it would pass the edited tables to the service to update the database. Is there problems with this design and the storage of the Dataset and Datatables as a session variable?
I have a problem with a SessionVariable. I will explain what is happening:
1. From the default.aspx I send Session["LoginByAdmin"] = "Dummy"; and then redirect to this page where I have the code below. So the Page_Load sees that this Session["LoginByAdmin"] != null and enter this page. This works fine !
2. In the Page_Load, I later fill a ListBox1 with foldernames.
3. With Button1_Click1, I will now delete the choosen Folder in the ListBox1 wich works fine the first time and the ListBox updates the new existing folders in the ListBox. (I have wrapped this inside an updatepanel)
The problems comes now when I try to delete a choosen folder in the ListBox1 the second time in a row. When I select a Folder in the ListBox1 and now Press Button1, I will be redirected to "Default.aspx". This meens that this code is running: (That meens that Session["LoginByAdmin"] == null and I have not set this to null anywhere. This is my big question how this variable can be = null here?
if (Session["LoginByAdmin"] == null) Response.Redirect("Default.aspx"); break;
I am using Label to display comments so in Csharp coding to display Comments on web page where One Default Image should be display , Name , Date , Comments .
OK, I have exhausted myself troubleshooting this bug. The crazy thing is, I think I had it working months ago, and now it does not. All I want to do is submit FrmCart when the "Update Total" link is clicked. Below is the code.
I have an ASP.NET web site with master/content pages. On the master page, there is a link to log-in and that brings up a modal jQuery form. How can I make sure that the info that is submitted on this form (which is just a DIV in my master page) is handled by a particular postback event?
Keep in mind that the modal can be submitted from any number of pages and I want to make sure that when the modal is submitted, the postback event of the content page is ignored while the postback of the master page handles the form.
Over team developed a website, which is base on blog post and share post , Actully i need to impelement commints on each post and mainten the tree on each comments (In simple way to say just like youtube)
I'm not sure the best place to ask this...not even sure the best way to ask it.
I manage a library website, and there are a number of different database products that can be searched. I'm trying to build a black box application to sit behind the home page. Here's an example of what might get submitted to said application.
See, the idea is that I might be doing various search boxes throughout the site, and I want to keep the actual HTML forms as simple as possible and simply let an ASP.Net application do the rest of the work. For example, figuring out whether or not the search engine using a GET or a POST method, parsing the keywords to determine the best way to render them, and sending the appropriate hidden values.
Probably, most of these databases use GET, so I can simply use a Response.Redirect after creating the query string, but I think some of them might use a POST, and I'm just not certain how I would take the form variables from one page (the home page, say), then essentially turn them into a virtual form on this middle man/black box application, and then programmatically submit that virtual form to another site, such that the user never sees or knows about that intermediate page.
I've seen this:
[URL]
But that isn't what I actually want to do, because I don't want to retrieve the result of the submission through a WebResponse...rather, I want the form to actually send the user to the new site.