asp.net-4.0

How to create RouteUrls with databound parameters declaratively?

孤人 提交于 2019-12-04 10:03:40
I'm using the new Routing feature in ASP.NET 4 (Web forms, not MVC). Now I have an asp:ListView which is bound to a datasource. One of the properties is a ClientID which I want to use to link from the ListView items to another page. In global.asax I have defined a route: System.Web.Routing.RouteTable.Routes.MapPageRoute("ClientRoute", "MyClientPage/{ClientID}", "~/Client.aspx"); so that for instance http://server/MyClientPage/2 is a valid URL if ClientID=2 exists. In the ListView items I have an asp:HyperLink so that I can create the link: <asp:HyperLink ID="HyperLinkClient" runat="server"

Is it necessary to create ASP.NET 4.0 SQL session state database, distinct from existing ASP.NET 2.0 ASPState DB?

假装没事ソ 提交于 2019-12-04 09:05:06
问题 Is the ASP.NET 4.0 SQL session state mechanism backward-compatible with the ASP.NET 2.0 schema for session state, or should/must we create a separate and distinct session state database for our ASP.NET 4.0 apps? I'm leaning towards the latter anyway, but the 2.0 database seems to just work, though I'm wondering if there are any substantive differences between the ASPState database schema / procedures between the 2.0 and 4.0 versions of ASP.NET. Thank you. 回答1: There was no quick answer on

Web.config appSettings: complex values

天涯浪子 提交于 2019-12-04 07:28:11
Is Web.config's appSettings section only capable of storing simple strings like this? <appSettings> <add key="OKPage" value="http://mysite.com/okpage.html" /> </appSettings> or I can have more complex values like CDATA or nested values? If not, is this the only place in Web.config where to store custom settings? Thanks Alex Aza You can make any XmlSerializable class as a setting. I answered to the similar question here: Custom type application settings in ASP.NET Also there is a sample project attached. Here is an example of the settings from my config file: <setting name="MyEndPoints"

How to save style-css values for Later use then Reload those values back

笑着哭i 提交于 2019-12-04 07:27:22
问题 Having a list of all SQL database-tables and their columns-names, each in List<string> Via a dropDown list control I already chose a table and the columns it has, then after the first stage, where I have chosen the table and it's columns I am navigating to a page that's has a Graphical User interface like in this screenshot: It will then as you could see in the picture, render an html table , with chosen columns as the htmlTable headers . So now when result is displayed in that aspx page, By

Control Attributes render Encoded on dot net 4 - how to disable the encoding?

无人久伴 提交于 2019-12-04 04:26:26
问题 I have an issue in asp.net 4. When I add an attribute on controls, then the render it encoded. For example, when I type this code txtQuestion.Attributes["onfocus"] = "if(this.value == this.title) { this.value = ''; this.style.backgroundColor='#FEFDE0'; this.style.color='#000000'; }"; I get render onfocus="if(this.value == this.title){this.value = '';this.style.backgroundColor='#FEFDE0'; this.style.color='#000000';}" And every ' hash been change to & #39; Is there a way to disable this new

Can't rename MSI afterwards

喜夏-厌秋 提交于 2019-12-04 04:13:28
问题 I am facing the following problem scenario: build an MSI the normal way ex: MyTest.msi rename it, leaving the msi extension. ex: MyTest_V1.0.0.msi Test it, it works. install success. Again repeat process. this time rename to ex: MyTest_V2.0.0.msi Test it, and it fails with a 'network error', while the file is on a local disk. " A network error occurred while attempting to read from the file MyTest_V1.0.0.msi " What gives, can't we simply rename an MSI file? Is there some issue that prevents

ASP.NET 4 jquery ajax webmethod call

老子叫甜甜 提交于 2019-12-03 23:13:45
问题 In ASP.NET 3.5 I had this javascript on a page (default.aspx): function getMoreNewsItems() { $.ajax({ type: "POST", url: "default.aspx/LoadNewsItems", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { alert(msg.d); } }); } With this in the code behind (default.aspx.cs): [System.Web.Services.WebMethod] public static string LoadNewsItems() { return "test1"; } I have a ScriptManager on the page with EnablePageMethods=true. All worked fine.

ASP.NET control to render a <div>

空扰寡人 提交于 2019-12-03 22:05:15
The Label control in ASP.NET seems to render <span> tags, but is there a server control to render HTML within a <div> ? Sure, I could set display: block and it might look the same, but I'd rather not be nesting divs inside spans. Also I'd prefer not to use <%= MyVariable %> because that might not behave nicely on postbacks. Any suggestions, please? I think you need HtmlGenericControl class. It has a constructor which accepts a string variable which initializes a new instance of the HtmlGenericControl class with the specified tag: var div = new HtmlGenericControl("div"); It is also has

IRegisteredObject not working as expected

做~自己de王妃 提交于 2019-12-03 21:39:07
Background I'm working on an ASP.NET 4 web site (not web application). I'm trying to use IRegisteredObject to allow some long-running code to run in a non-request thread. For testing, I've set the IIS 7.5 application pool's recycle interval to low values so that it will try to recycle while the background thread is running. Code public class AspFriendlyBackgroundJob { private readonly object key = new object(); private readonly Task task; public AspFriendlyBackgroundJob(Action work) { lock (key) { HostingEnvironment.RegisterObject(new Stopper(this)); task = Task.Factory.StartNew(work); } }

Options for real-time web notifications and updates using Comet/XMPP vs WebSocket technologies on a Microsoft stack?

泪湿孤枕 提交于 2019-12-03 19:28:32
问题 I am scoping out the architectural options for a project that will render live updates (like Facebook) of user activities - logins, photos, etc. Two main UI components of this are an auto-updating scrolling area where new notifications will be listed (photos, etc.), and a toolbar that will update with things like updated message counts, etc. The contenders for this are Jabber/Comet/XMPP-based and WebSocket technologies. Comet camp: Pokein WebSync WebSockets camp: Kaazing LightStreamer