|
I attempted that but I still can't find the exact article.
|
|
|
|
|
|
|
Hello,
In my asp.net 2008 project, I am using the login controls...
In the local sql server, there are all the necessary tables and stored procedures which the system creates for the relevant login controls...
All working fine...
I notice in the webconfig file there is an entry under connections, i.e.:
<add name="LocalSqlServer" connectionString="Data Source= ...
Now I would like to put the project into the Dev server.
What do I do in terms
1- putting my web project into the Dev machine so that we can test it on the Dev server?
2- how do I put the login database schema into Dev? Is it just a matter of restoring my local DB into Dev?...
Thanks
|
|
|
|
|
The easy way is on your development server
go to following path
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
and run
aspnet_regsql.exe
and then point your database here by following the wizard. this will register the sql server and will create all your role and memebership tables. if you want to use the existing database you can specify here so that it will use those tables.
-----
or
in your web.config file you can set your membershipproviders with proper cinnectionstring.
|
|
|
|
|
|
Hi,
How can I retrieve the list of all the request I made it to server with respect to time required to process time for it.
For ex:
In my page I am using some web services. I want to retrieve list of all the web services I am using and time required to process this request. How can I do this.
Thanks & Regards
Rock Star
|
|
|
|
|
If this is for performance troubleshoot then
i.e.
On that method which you want to troubleshoot
add a Label called lblResponseTime on the page somewhere and do the following on your method
protected void cmdSearch_Click(object sender, EventArgs e)
{
DateTime responseStart = DateTime.Now;
DateTime responseEnd = DateTime.Now;
TimeSpan responseTime = responseEnd.Subtract(responseStart);
lblResponseTime.Text = responseTime.Seconds + ":" + responseTime.Milliseconds;
}
this will calculate response time taken for that action.
|
|
|
|
|
Hi,
I want to upload multiple files by selecting directory. I am using File Upload Control and Button.
If any other solution then just let me know.
Thanks
|
|
|
|
|
|
How to Avoid Duplicate record insertion on page refresh(F5) in ASP.NET using C#
|
|
|
|
|
Just after record insertion or update, redirect to the same page.
MyData.Insert();
Server.Transfer("SamePage.aspx");
Hope this will solve your problem.
|
|
|
|
|
Thanks for your replay.But it is not working.
after submit i want to display message "that data has successfully inserted".but when i redirect the page it not show.
|
|
|
|
|
To display your message, you can use querystring
like:
string Msg = "The data has successfully inserted";
Server.Transfer("SamePage.aspx?msg=" + Msg);
Then, read the querystring and display the message if any.
if(!string.IsNullOrEmpty(Request.QueryString["msg"]))
DisplayMessage();
There should be some better way also but at this time, this is what is hitting in my mind.
|
|
|
|
|
Put this in the page load
if (ispostback)<br />
{<br />
return;<br />
}
|
|
|
|
|
You could check your database to see if a record with all the information has already been inserted.
|
|
|
|
|
I dont have details of your requirement.One way also might work for you, just have a flag in viewstate at your page,set it true once inserted and check on every record insertion.
Or Simply you can have check at your DB side so that it wont insert the same record more than one time..Cheers!!
Brij
|
|
|
|
|
For insertion you can validate at your database(and you should).
But If you update your record once, then press F5, the same record will be updated twice.
There is no harm, but why to update twice...
Using ViewState might also not work for Updating data because user may update the same record after next postback.
I hope you are understanding what i am trying to say.
|
|
|
|
|
I understood your point.. Thats what I said it should be done keeping in mind the requirements of the Page.
Anyways thanks for pointing it out.Cheers!!
Brij
|
|
|
|
|
There is no straight forward way to avoid this without refreshing the page. The simplest way to go is to use Server.Transfer or Response.Redirect from the server after completing the save.
Since you wish to display a message then you can do it in either of the two ways.
1. Simply put a button to refresh the data above the data section and hope that users use this instead of the browsers' refresh button [F5]. In most cases, the users would use this instead of F5. If its a intranet application then you can even educate your users on the same. You could also put a message next to the button telling them to use this rather than F5.
2. After you complete the save and give the message, just push a client script that would refresh the page using say "window.self.location=" after waiting for a specified time say 5 seconds. That way, your message would be visible for 5 seconds and the postback would be cleared.
|
|
|
|
|
i appreciate your solution but there is some problem in your solution.
1)i cant forced any user to use only refresh button.user can click any button.
2)second option is seen good but it is not a appropriate solution of my problem.
i want to display message when submit button will press,and when user click on refresh(F5) then message will we clean.
|
|
|
|
|
How about clearing the fields/variables after insertion? Then before inserting you validate that data to make sure it exists.
|
|
|
|
|
I invested some time investigating this and the only solution I found working is based on some interaction between client data (ViewState, ...) and server data (Session, ...). Why:
- I don't accept solutions like "Check if the record already exists in the database" etc., because this is limited to inserting data to database, useless for any other scenario. Plus it has other flaws.
- You can't rely solely on client data (by this I mean data received from the client, like ViewState, POST data etc.), because when the user hits F5, the same request with the exact same data is sent to the server - if you accept the request as genuine the first time (and insert some data to the database), there is no way to dismiss it the second time (after refresh) because the data is exactly the same, so any deterministic algorithm for refresh detection can't possibly work. Half the people in the posts above don't realize this.
- I don't accept page redirections, because they either don't work (see above, try yourself if you don't believe) or if you try hard and make them work, they destroy the page state so it may be difficult to keep track of where the user was in the application, etc.
This eliminates all the solutions from the above posts. Like I said, the only way I got to work was to maintain a state-interaction between some Session variable (or any server piece of data) and ViewState variable (or any client piece of data). During normal requests, you keep these in sync and when you receive some Insert request, you compare them and check if they are in sync. If they are, the request is genuine and you can perform the insert. If the user hits Refresh (F5), the ViewState data is old compared to the server data and you recognize the request as refresh and do not perform the insert.
I event made a small component for this purpose, which you simply add to the page and then call BlahBlah.IsRefresh whenever you need. I can publish it somewhere if anyone cares. I think Microsoft should have long ago addded this functionality to the Framework so we could call Page.IsRefresh just like Page.IsPostback.modified on Wednesday, February 17, 2010 3:56 AM
|
|
|
|
|
I am developing a mail application. Through smtp I am sending mail.
I work properly. Mail will send successfully.
After sending mail I am display message your mail has send successfully(which is show after the mail has been send).
But the problem is that when I press F5 button then mail again send.
And it is sending again and again when ever I press F5
I donot want to send mail again when pressing F5 and message will also will display after mail has been send.
I tray to redirect the page it solve my problem to resend the page but in this situation massage will not display.
Plz can u help me
|
|
|
|
|
Im having around 30 Checkboxes in page i need to insert name of those checkboxes in a single column(seperated by comma) of table into db and also need to bind them from db
how can i do it in simple way....
|
|
|
|