|
Please do not cross-post. You've already posted this in the C# forum.
|
|
|
|
|
I would like to share sample program regarding files clean up on Browser close button.
1.Include below script
<script type="text/javascript">
$(document).ready(function () {
$(window).unload(function () {
if (event.clientY < 0) {
$.ajax({
type: "POST",
url: "Default.aspx/Cleandir",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: true
});
}
});
});
</script>
2. In code behind, create method using [WebMethod]attribute.
[WebMethod]
public static void Cleandir()
{
try
{
DirectoryInfo dirinfor = new DirectoryInfo(@"C:\Users\Desktop\image");
if (dirinfor.Exists)
{
FileInfo[] filename = dirinfor.GetFiles();
if(filename!= null)
{
if (!(filename.Length.Equals(0)))
{
foreach(FileInfo f in filename )
{
File.Delete(f.FullName);
}
}
}
}
}
catch (Exception ex)
{ }
}
}
Basically web method is being called using Ajax in jquery when user clicks on Browser close button.
Thanks,
Ashwani Kumar Vishwakarma
From Jabalpur
|
|
|
|
|
Why post this here? You do know that it will disappear off this page pretty quickly don't you? Why not post it as a Tip/Trick instead?
|
|
|
|
|
I'm looking for some kind of best practice fot imersonate users to one ASP.NET site that I build.
The user handling of the site is entirely own built with a "User" table in the database and so on. The "Password"-column is crypted.
Now I want to build a simple and SAFE solution for our support personal so they from our Support site can click on a button and a session is started in the customer portal. That so he support person more easily can log in as he was the customer user and se the same thing as the customer do.
Any tip on how to solve this is welcomed. Now I think about creating a GUID and send that in querystring that is pased to the customer portal. The GUID can be used for a short period.
_____________________________
...and justice for all
|
|
|
|
|
how to update data in grid view???
|
|
|
|
|
|
Hello all,
On the left side of my page we have created toolstrip, with that we have panel & property grid. we have images in toolstrip when i click on the image. image goes to panel where we can large the image and assigning the values of image to property grid with these line of code.
propertyGrid1.SelectedObject = (sender as System.Windows.Forms.PictureBox);
Now my problem is when click on the image it move slightly. we want to stop that click of image. Please help me.
Thanks in advance.
Sanjeev
|
|
|
|
|
Wrong forum! You should have posted in C# forum[^]
For now, to stop click of image, you can make it readonly/disabled?
|
|
|
|
|
Hi
In my page i have 4 text boxes which are associated with ajax calender.user can enter the date or can select from the calender.Currently I have put 4 custom validator to validate the user input and I have associated a jave script function onclientfunction of the validators to check the date format. My idea is that if i put only one custom validator and can check for all the different inputs to validate the date. is it possible?
my java sript function takes two parameters (source, args).If it is possible please send me the sample code.
In custom validator there is one attribute which says the control to validate?Now for each control i have to put a validator. I want one validator to check for all the text input.Is it possible. I am new to ASP programing.So please give the sample code. I want like if i exit the text box or click on the save button this should work.And this should be done in client side not in the server.
Thanks
Prashant
|
|
|
|
|
i want to set a value of label using javascript and that value will from asp.net codebehind...
codebehind code:
vimage.Attributes.Add("OnMouseOver", "divimgcomments('" + divcmdstext + "');");
javascript code:
function divimgcomments(imgcmds) {
//alert(imgcmds);
var _vlblmoimgcmnds = window.document.getElementById("<%=lblmoimgcmnds.ClientID%>");
_vlblmoimgcmnds.value = imgcmds;
divimgcomments1();
}
|
|
|
|
|
Not too clear on what is the issue and what you seek!
Try:
vimage.Attributes.Add("OnMouseOver", "divimgcomments('" + divcmdstext + "');");
function divimgcomments(imgcmds) {
var _vlblmoimgcmnds = window.document.getElementById("<%=lblmoimgcmnds.ClientID%>");
_vlblmoimgcmnds.InnerHTML = imgcmds;
}
|
|
|
|
|
Bind Two charts from two dataset shoing charts grouped in RDLC asp.net
|
|
|
|
|
|
I was looking for how to use the dataadapter to make updatings on multiple tables with a single transaction.
I´ve found a couple examples, but they just add, more questions. As I understood in order to dataadapter could trace the table´s changes we have to fill the dataset with each table data store in the database by doing select * from table and then using dataadapter.fill method. But in the most of cases the tables are so big enought and because of web environment many user can using the application at same time, the server could easily crash.
When I use classical asp 3.0, I created *.cls classes and compile them to get an .dll file.
One of the more important class was one it wrapps the database operations. basically its structure was: two properties,bSuccessful,sSql. Its methods ExecQuery
wich basically was
bSuccessful = 1
sSql = "update,insert,delete ...."
oConn.execute
on error:
bSuccessful = 0
exit sub
For example, clsEvaluation has a RegisterEvaluation method,
it uses the clsDBoperation in order to control the operations.
RegisterEvaluation
set oConn = new clsEvaluation
oConn.Connect
oConn.startTransaction
oConn.setsSql = " insert, edit , delete .... "
If oConn.getbSuccessful = 1 then
.....
else
oConn.stopTransaction
endif
I did did the same, building a class with .NET 3.5, but now i´m wondering can it be achive using a dataadapter?
P.D: I´m sorry if the question is long but I considered to be as clearer as possible
|
|
|
|
|
Is there any Need to Install Crystal Reports on Web server if we Use them in our Web Application
|
|
|
|
|
You have already asked this in QA.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
|
ashjassi wrote: Shut up u r idiot
Thank you. Coming from someone that cannot spell or write a complete sentence, you certainly proved your superiority.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
modified 6-Oct-12 9:56am.
|
|
|
|
|
Avoid cross-posts from next time. Pick a forum that looks most suitable for your question and stick to it.
I replied you in Q&A: Crystal Report Runtime support[^]
|
|
|
|
|
I'm working on a web application that allows you to import an excel spreadsheet with a list of users. When importing this spreadsheet what it does is creates users in active directory and then enables the user mailbox in Exchange.
I'm more a Windows developer but what I'm wanting is to display a progress percentage and text on what user it is on and a list of ones that may have failed.
I've done some googling and found a lot of information on this topic (http://msdn.microsoft.com/en-us/magazine/cc163553.aspx[^] and even Use the Asynchronous Power of ASP.NET to Create a Simple, Reusable Page for Displaying a Processing Message[^]).
What I am wanting to know is which of these would be a better option for what I'm trying to do? Would creating a web service that reports the progress be best?
If I do a web service would it work like this:
1) User submits list of users to Web Service
2) Web service gets list and returns a Guid to page
3) Page redirects to another webpage with the guid session variable or query string
4) Web service starts the task and logs its progress to a SQL database
5) Page constantly refreshes (every 1 or 2 seconds), pulling the latest information regarding that GUID from the database and displaying it.
6) Web service logs the "COMPLETED" task in the database
7) Web page receives the "COMPLETED" information from the database and stops refreshing..
Sorry for the novice questions on this topic.. just wanting to make sure I have the workflow correct
|
|
|
|
|
If your good with javascript and char arrays, then maybe you can parse the excel file using client script, and then the list to a web service 1 user at a time, in a loop, so you can update the progress and results.
|
|
|
|
|
I'm not really that great with javascript but wouldn't that be opening my web service for anyone to use?
If I was callign the web service from code behind I can limit it to that specific IP. If I am callign it with javascript then that is client side code which would mean I would have to open the web service to the world.
Not sure if that would be best for my situation
|
|
|
|
|
Well of course, but I think there is a rule in javascript, which only the originating website can consume a web service, you can't go cross domain using $ajax, you have to use something else to go cross domain.
I don't what to tell you.
You want to do something really really complex, and your not sure how to plan or engineer the task, plus your not familiar with some of the rules regarding how to secure the application.
Then you need to start simple and upload the excel file first. Then read the file and parse the data you need. Then create your accounts, update your database, and return a result first.
Then take the pieces, optimize them, and you can rearrange the parts, to be more fluid.
In theory, with really well written code, shouldn't take more than a few seconds to complete the task.
|
|
|
|
|
I'll see what I can find out.
I have already wrote all the code that uploads the excel spreadsheet, creates the active directory users, then enables the user's mailbox in Exchange. This is all working just fine.
In theory this type of import will not take a few seconds. You are talking about upload excel spreadsheets that contain numerous amounts of users (One client is 700 users for example).
So that is 700 calls to Active Directory that creates the user object, another 700 calls to add that new users to the correct security groups, then another 700 calls to Exchange using remote powershell to enable the user object for mail. Remote powershell is not that fast anyways.
I was really just looking for a type of tutorial or a working example of what I am looking for, which is just being able to relay information back to the client about which task the server is currently performing.
|
|
|
|
|
I forgot, that’s going to take awhile, maybe an hour or two. Maybe 4 or 5 hours. Writing to active directory isn’t that fast.
Just tell them it will be ready in the morning
Well, if you look at windows update, or Microsoft virtual server, the web interface, that’s the most advance stuff that I have seen. I’m trying to think of more examples.
You can try the google forums, and I think Gmb something.
I don’t know of any turtorial, that’s probably going to be home brewed.
I tried some stuff in the past that worked, but then an update to asp.net came out and it killed my work.
Today I just avoid that stuff.
I would use uploadify to upload the excel file, attach uploadigy to a generic handler, process the excel file, return a json array to javascript with the names via generic handler, then create dynamic javascript and populate a div container using append, with progress updates, feed each user in 1 at a time through a web service to create each user, return json with the status when complete, loop again till done. When done, create a complete button via dynamic javascript.
Since the whole thing is ssl, and session protected, security should be covered. Generic handlers are session capable.
if you call a web service ssl, it will be ssl. You can tweak a web service to be session capable. Add some tokens to the javascript ajax for authentication, tweak the names to make it real confusing to the average joe.
|
|
|
|