asp.net

How to deal with different kinds of encoding in the javascript

I recognized that based on a context in which I want to use some parameters, there are at least 4 kinds of encoding that are necessary to avoid corrupted code being executed : Javascript encoding when constructing a javascript code, e.g. var a = "what's up ?" var b = "alert('" + a + "');" eval(b); // or anything else that executes b ...

How to format html table with inline styles to look like a rendered Excel table?

I'm currently stuck settings border in a html table. (I use inline stiles for a better rendering in e-mail-clients) I have this piece of code: <html> <body> <table style="border: 1px solid black;"> <tr> <td width="350" style="border: 1px solid black ;"> Foo </td...

A non-locking in-process ASP.NET session state store

I'm using ASP.NET's in-process session state store. It locks access to a session exclusively, and which means concurrent requests to the same session are served sequentially. I want to remove this implicit exclusive lock, so multiple requests per session can be handled concurrently. Of course, I'll be synchronizing access to the session...

asp.net form postback or not depending on button clicked

hi everyone! I need an idea for a situation like this: There is this aspx form which contains some buttons like "save", "import", and print; on the last one clicked a window should appear providing the user with a print-friendly version. what i need is the form not to cause postback and reload in this case, while normally postback-ing w...

search and result in asp.net mvc c#

i have a textbox with button search. i would like to search my database of input text from textbox and give result out in one view. Could you please give me link or help me how its possible to implement? I have no idea what i shoul to do that. ...

Custom validation through Web-method

For validating login field (at register form) I use customValidator <asp:CustomValidator id="uniqueLoginValidator" class="validator" runat="server" ControlToValidate="tbUserName" ErrorMessage="Login duplicate" ClientValidationFunction="LoginValidate"/> For validate login I need consume wcf, so decide use web-methods <scrip...

Example of use GetRolesForUser();

Hi, I need to check in conditional logic if a user has more that one role associated. Script should work like: If a user has 1 role CODE OK If a user has more that 1 role CODE ERROR The method is GetRolesForUser(); But I do not know how to use it, could you please give me a sample of code? how to implement it, arrays? Thanks guys ...

Asp.net: disable autopostback of checkbox inside of GridView during SelectedIndexChanged of ListView

Hi, I hope my question is clear: I have a checkbox placed inside a gridview: <GridView> <asp:TemplateField HeaderText="Driver"> <ItemTemplate> <asp:CheckBox ID="CheckBoxDriver" AutoPostBack="true" OnCheckedChanged="GridView_Persons_SelectedIndexChanged" ValidationGroup='<%# Eval("ID") + "-" +((GridViewRow)Container).RowIndex...

ASP.NET Redirect to other page internal

Is there a way to redirect a asp.net page to another and restart the server workflow without the user seeing it in their browser? Call to .NET Page (handled by routing) Perform some actions based on this call Call other webpage internal (handled by a httpmodule) The internal page don't "exist" (passes though a module that performs...

how to create 1px X 1px on .Net

I need an image 1px X 1px or empty Jpeg image using c# ...

asp.net mail add ReplyTo

How can i add a a different email then the sender in the ReplayTo field ? Seems MailMessage.ReplyTo is deprecated so I'm trying to use ReplyToList instead. But it's telling me that Property or indexer 'System.Net.Mail.MailMessage.ReplyToList' cannot be assigned to -- it is read only Here is my code so far: var reply = new MailAddres...

JQGrid form editor displays in the middle of the screen on top

In my JQGrid everything works fine except for the form editor.. Do now know why but the form editor displays in top-middle of the screen. Below is my code $(document).ready(function () { var briefallocationid = $("#BriefAllocationId").val(); var updateDialog = { url: '<%= Url.Action("UpdateRegionAndCity", "BriefAlloca...

ASP.NET app works on Cassini but not in IIS on xp?

App works fine in IIS on Windows 7 on my dev machine. Trying to debug on a client machine running XP and VS2008 and the app works ok running on Cassini, however when I select IIS I am getting a 403 forbidden error. Anonymous access is switched on in ISS. Can anyone help work out why it won't work in IIS? ...

Date validation for a textbox

I have been using this to take date as mm/dd/yyyy format... <asp:CompareValidator ErrorMessage="(mm/dd/yyyy)" Display="Dynamic" ID="valcDate" ControlToValidate="txtDob" Operator="DataTypeCheck" Type="Date" runat="server"></asp:CompareValidator> <asp:RangeValidator ID="valrDate" runat="server" ControlToValidate="txtDob" ...

ASP.NET Data Caching? Memcache equivalent

Having used PHP on Linux a lot, I'm used to using memcache so that the database doesnt have to be accessed on every single request. What do people use on Windows the achieve this? From the asp.net mvc applications which I've seen, none of them use any sort of cache, they just hit the database on every request? Is this common, and if so, ...

How To Log User In To ASP .NET Site Automatically If They Are Logged In To Active Directory?

Hi, Our client's site currently uses forms authentication, so users have to go to the login page to type in their username and password. There are custom membership and role providers that access a database through NHibernate to get users and roles. The client now wants users from within the local Active Directory to get logged in aut...

swfupload won't allow me to upload from a server to another one

hi , we have two webserver and we have dedicated the task between these two servers. we've decided to put all the asp/aspx page into one server and put an upload.aspx + sql server into another one: and here is name of the servers : http://server1.somecompany.com // this is where all the pages reside + swfupload http://server2.somecomp...

ASP.NET MVC Get ID of last added record

I'm using an MVC webform to insert a record into a database with several subrecords. In my code-behind I'm first creating a new main record using dataRepository.Add(xx). Now I need to add 5 subrecords that need the ID of the newly created record. How can I retrieve that? ...

System.OutOfMemory exception while exporting large result set to crystal report in ASP.Net

I get System.OutOfMemory exception while exporting large result set containing 1 million records to crystal report in ASP.Net. I get the datasource perfectly from database the problem occurs only when i set datasource for the report and load the report. The exception comes after sometime of setting datasource to the report. The error pag...

how to insert image in html.actionlink - asp.net mvc

how to insert image in html.actionlink - asp.net mvc? i did it so, but it doesnt works. <a href="<%= Html.ActionLink("search", "Search", new { searchText = "txtSearch" }, null); %>"> <img alt="searchPage" style="vertical-align: middle;" height="17px" src="../../Stylesheets/search.PNG" title="search" /> ...