Does anyone know if MS has implemented some performance improvements in .NET 4? I'm always interested in learning about that. By performance improvement, I mean same exact code executing faster and delivering desired results faster. I usually see some articles about performance improvements before the release of a new version of MS technology. I haven't seen any this time. Have missed any or .NET has already matured to a point where one shouldn't expect much performance improvements?
I am working on a ASP.Net Web Application which need some requirement as given below. Let's say two user's A and B. When a User A Assign a task to B , Then B need to get some sort of alert message without doing any action by B in his web browser, which need to tell User B that user A had assigned him some task and he need to response back to User A at the same time by and acknowledgement saying he accepted the task or rejected. Here I can not use the Mail server feature. Here user B need to get the pop up/alert message at the same time when user A posted the Task.
For every incoming request I need to perform custom authorization before allowing the file to be served.
(This is based on headers and contents of the querystring. If you're familiar with how Amazon S3 does rest authentication - exactly that).
I'd like to do this in the most perfomant way possible, which probably means as light a touch as possible, with IIS doing as much of the actual work as possible.
The service will need to handle GET requests, as well as writing new files coming in via POST/PUT requests.
The requests are for an abitrary file, so it could be:
GET http://storage.foo.com/bla/egg/foo18/something.bin
POST http://storage.foo.com/else.txt
Right now I've half implemented it using an IHttpHandler which handles all routes (with routes.RouteExistingFiles = true), but not sure if that's the best, or if I should be hooking into the lifecycle somewhere else?
I'm also interested in supporting partial downloads with the Range header. Using
response.TransmitFile(finalPath);
as I am now means I'll have to do that manually, which seems a bit lowlevel?
I've previously seen answers on Stackoverflow that involve using 'the c# construct' to essentially perform an 'if' statement in the html of a asp.net page.
So imagine i want to display Eval("option1") if its not null OR Eval("option2") if option 1 is null. How do i do this?
What this code does at the end is Redirects to a direct download, and THEN afterwards, to a "tutorial page" on how to use the download. I can't seem to use these back to back. I've even used Response.Redirect(tutorialURL, false) so it wouldn't terminate processing, but it didn't work. It just STOPPED page processing. I've tried to use the Sleep() method of the Threading namespace, no luck. I'm sure there's an easy way to do this, I just don't know what it is.
Is there a way to select certain rows and for each row, perform a function? Specifically, I want to select specific rows and then send them an email.
Here's a breakdown:
1. Select * from STUDENTS where status = active 2. For each row that is returned, take the $email column and email the student message 3. Repeat until all qualifying rows have been completed.
I have a function that finds a files MIME type for download purposes. I use this DllImport:
Code: [DllImport("urlmon.dll", CharSet = CharSet.Unicode, ExactSpelling = true, SetLastError = false)] static extern int FindMimeFromData(IntPtr pBC, [MarshalAs(UnmanagedType.LPWStr)] string pwzUrl, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.I1, SizeParamIndex = 3)] byte[] pBuffer, int cbSize, [MarshalAs(UnmanagedType.LPWStr)] string pwzMimeProposed, int dwMimeFlags, out IntPtr ppwzMimeOut, int dwReserved);
I use this function:
Code:
#region GetMimeFromFile(string) public static string GetMimeFromFile(string file) { IntPtr mimeout; if (!File.Exists(file)) { throw new FileNotFoundException(file + " not found."); } //if int maxContent = (int)new FileInfo(file).Length; if (maxContent > 4096) { maxContent = 4096; } //if byte[] buff = new byte[maxContent]; using (FileStream fs = new FileStream(file, FileMode.Open)) { fs.Read(buff, 0, maxContent); } //using int result = FindMimeFromData(IntPtr.Zero, file, buff, maxContent, null, 0, out mimeout, 0); string mime = Marshal.PtrToStringUni(mimeout); Marshal.FreeCoTaskMem(mimeout); return mime; } #endregion
Locally, it runs fine. However, when I put it on a GoDaddy server, I get the error:
"The application attempted to perform an operation not allowed by the security policy. To grant this application the required permission please contact your system administrator or change the application's trust level in the configuration file. "
My stracktrace points to line 256, which is the ending french bracket of my GetMimiFromFile function.
how am I be able to perform a client-side timer, in which I'll be using time the time of the server. I am currently using an Ajax-Timer but it does a postback.
In my ASP.NET website, I am having a function which has to be automatically performed once every 2-3 mins on its own, i.e. without user intervention. This function contains database access.
Can I use threading to perform this process in background?
If Yes, How can I use that?
Edit
Also I am not looking for a solution which includes windows service because I am using shared hosting. So I dont have all the rights to access the host computer.
I find myself needing to preform the same actions on both HtmlControls and WebControls. I am a firm believer in DRY and find the fact that there is only the Control class to use if I want to consolidate the functions on both types. The problem that I have with using Control is that there certain properties that both HtmlControl and WebControl expose that Control does not. In the current case, the Attributes property is the problem. how to avoid the duplication of code in this type of instance?
After a user creates an account on my website, I want to redirect the user to the home page and display a twitter style message bar on top. This is how I have it:
success: function (response) { if (response.Success) { location.href = response.ReturnUrl; } ShowMessageBar(response.Message); },
The message bar does appear but it gets displayed only for a second as it gets canceled by the redirect. What can I do to display the message right after the redirect has completed? Is there a complete event for the location.href?
My task is to create an ASP.NET application with a piece of code which will automatically run every half an hour. This code must append a record to the file every half an hour. It should not depend on users requests(whether they happen or not).
1) I'm writing my code in Application.Start method of Global.asax file. Am I right?
2) Do I have anything to do with the hosting (IIS) settings (e.g. change permissions to write the file, etc)?
I have already tried just putting the code to write to file into a loop in Application.Start method and then just copied the project directory to the server. However, it didn't work.
I have 2 web sites both located physically on the same web server, I'll call them siteA and siteB. These sites are accessed by internal users on our intranet as well as external users on the internet.
SiteA is is setup on IIS6 using basic authentication which we connect to an active directory. The web config is set to use Windows authentication mode. The url to site a is etoolbox.xxx.yyy
SiteB is the same setup. The url to siteB is rdow.xxx.yyy
What I want is once the user is authenticated against the active directory when the login to SITEA for them to be able to click the url in siteA which opens SiteB in a separate browser window and automatically takes them to the welcome page without being prompted for credentials again.
Currently when clicking on the url to go to siteB I am being prompted again for my credentials.
Is there any way for both external and internal users to only be prompted once for their active directory credentials and then be able to go to whatever site they want to without be prompted for credentials again? Is this something I have to code for or is it handled automatically by IIS?
Without giving away specifics: basically, I have a bunch of users adding content to my site. What happens now is ajax sends the text to a web service which does its thing, sends the info to the DB, Sends the user an e-mail, and then returns a response to the browser to do something.
What I would like to do is change that order. I want to return a response to the browser so the user is not waiting on the e-mail to send before they get their response. Basically, I'm trying to gain every milisecond I can to quicken the response, and there's no reason for the user to wait for the server to send their e-mail before it tells them that everything worked ok. If the info went to the DB, that's all the user needs to know, they'll know the e-mail sent when it shows up in their inbox. I notice this is an issue on my local machine which has no SMTP server and can actually hang the page response up for a few extra seconds because it's throwing errors trying to send something with no SMTP server.
So, I know in my function when I say
[Code]....
it WORKS, but I want to send the e-mail after the return. Is there ANY way to get this to happen?
I'm a asp.net newbie trying to figure out how to do the following. I have a datatable. I want to extract the first row and perform a certain operation and a different operation on the remaining rows. How would I loop through the datatable to do this?
There's so much hype about ASP.NET MVC these days, but the truth is that ASP.NET webforms is not going anywhere for some time. Is there any way for current developers to optimize ASP.NET webforms to perform as fast as ASP.NET MVC?
I have noticed a significant difference in speed between ASP.NET MVC and ASP.NET webforms. MVC is a lot snappier and loads pages faster than webforms. Can I achieve the same with ASP.NET webforms by optimizing it? If yes, what would you recommend?
For example : I have UserID and UserName. So I use DropDownList. UserName is DataTextField and UserID is DataValueField. So User can choose their name and I save UserID to my database. But If User is new and not registered. I want to allow to type in DropDownList and I save the name to database. So for registered people can choose and not registered people can key in.
i have been assigned a task to develop ICR in asp.net using c# i have no idea to implement it please give me idea from scratch, and also how to write code and which name space is used to perform this task
I have a listbox on my site that is populated with data. I then have a textbox that is used to enter a search phrase and with each letter that is added the listbox is narrowed down or repopulated using javascript. I use one listbox to store all the items and a secondary showing the listing results. This makes it east to check against all items and then populate the second listbox with all the results according to the search.
Currently this process can cause a delay in updating the listbox (eg when the textbox is emptied all the items need to be repopulated from the listbox with all the data).
What is a quick and efficient way to perform this listbox search?
I have an MVC app that uses [Authorize] to protect the private bits. When I select the SignOut() URL it signs me out but if I hit the back button on my browser the it goes to the secure page and even lets me use the form. The action takes place and then it shows that I'm signed out. The problem is that it performs the secured action (inserting a row into my database). Then I can use the back button again and do it all over. Am I missing something important? It seems like it could be a really big security issue.