Asp.net redirecting w., ww., wwww. to -> www

I'm trying to redirect site.com w.site.com ww.site.com and wwww.site.com to www.site.com. My boss wants to ensure typos make it to the site as well. They redirect fine. I'm using ASP.Net and throw a 301 redirect back using a regular expression, however, tools such as http://www.seoconsultants.com/tools/headers.asp don't seem to show a correct redirect when I try to use w.site.com ww. etc. I'm trying to figure out what google sees, but I'm not sure where to check. It would "appear" that fi

ASP.NET Login Control is redirecting to default.aspx even when the destinationpageurl is not set

We have a login control on a page named login.aspx which is set as the start page of the website. Once the user logs in, it is redirecting to default.aspx although our destinationpageurl is not set to any value. If we set the destinationpageurl to somepage.aspx, it is working redirecting properly, but why is it redirecting to default.aspx by default, if the destinationpageurl is not set. Thanks for any help, Animesh

Asp.net How do I avoid these deadlocks?

I have a routine which is updating my business entity. The update involves about 6 different tables. All the commands are being executed within a transaction. Recently, I needed to add some code into the routine which accesses a lookup table from the database. The lookup code already existed in another business object so I used that business object. For example: Using tr As DbTransaction = myConnection.BeginTransaction() ExecuteCommand1(tr) ExecuteCommand2(tr) If myLookupTable.

Asp.net VS2008 - Can aspx inline reference 'Cannot resolve symbol...' should stop the build?

I'm looking for a way to mark a build as failed if an inline reference on an aspx page is invalid. For example: <asp:TextBox ID="TextBox1" runat="server" Text="<%# Model.SomeText %>"></asp:TextBox> If SomeText doesn't exist on Model I get the following message: Cannot resolve symbol 'SomeText' However, the application builds just fine. Is there any way to halt the build or mark it as failed when references such as this don't resolve? I've tried 'Treat warnings as er

How to loggedin in LinkedIn automatically from Asp.net Application?

I have created a username and password to enter and search people in linkedin. Now, I am devloping a web application using asp.net. I need to open a popup page which is displaying the searched results in linked in as logged in. When the popup page is displaying, I need to logged in automatically using the username and password. So, here is my question, How to logged in automatically when the button clicked in Asp.net application using linked in username and password?. Thanks

Asp.net How do I handle a server side exception during an Ajax call from JQuery?

I am calling a Page Method from JQuery as described here: http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/ This is all working fine. During testing I came across an error when my response from the Web Method was too large: Error during serialization or deserialization using the JSON JavaScriptSerializer. The length of the string exceeds the value set on the maxJsonLength property. I was able to do a bit of research on the maxJsonLength property and set it

ASP.NET with Javascript disabled

As you probably know, ASP.NET injects some javascript code to the form, like so: <script type="text/javascript"> //<![CDATA[ var theForm = document.forms['aspnetForm']; if (!theForm) { theForm = document.aspnetForm; } function __doPostBack(eventTarget, eventArgument) { if (!theForm.onsubmit || (theForm.onsubmit() != false)) { theForm.__EVENTTARGET.value = eventTarget; theForm.__EVENTARGUMENT.value = eventArgument; theForm.submit(); } } //]]> </

How do I combine jQuery and ASP.net to communicate enough to not refresh a page?

I have an jQuery accordion for a form on an internal company website. They seriously want to stick with their ASP.net technology (I know I'd bark at them if an intern could do that reasonably). Project description: Creating a basic CRM form The first slide of the accordion has their basic input for recording contact information which will include a client we already have recorded. If the contact isn't already in the database and they try to use it, the accordion will move to the next slide a

Asp.net gridview rowdatabound event in winforms?

in asp.net we can handle the RowDataBound event of the GridView control. this event fires when every row is added to the gridview. i want to be able to handle this event in the gridview in a winforms application but i cannot find a similar event. my question is what is the event name that allows me to do the same as RowDataBound in asp.net?

Sending Asp.Net email through gmail

I am trying to send an email via GMail from ASP.Net using the code and config below. Unfortunatly it doesn't seem to be working and it also isn't throwing an error message. There is nothing in the server logs or the mail IIS mail folders, I even checked the trash of the from address to see if the mail ended up there. Any help would be really appreciated. C# Section public void SendFeedback() { string emailFrom = this.Email.Text; MailMessage message = new MailMessage()

Asp.net session object design pattern

I'm looking to build an ajax page; it's a reporting page. By default, load today's report. On the page there's a calendar control and when the user clicks on a date, reload the gridview with the corresponding data. Is it considered good practice to do the following: 1) on the first page load, query the data for the page 2) put the query result in the session object and display it in a gridview 3) if the user requests new data, get new data from the query with different parameters 4) put the res

Asp.net Dynamic Data Linked Field Names

I have a couple of tables roughly as follows (ignore the bad db design, just trying to simplify) Person ------ Id Child_1 (FK back to person) Child_2 (FK back to person) When I apply the asp.net dynamic data to the linq to sql model generated by this I get columns in the grid named, "Id", "Person1" and "Person2" it seems to be using the name of the table referenced by the foreign keys rather than the column name (which seems a little odd to me) What's the easiest way to configure it to use c

Content getting outside ContentPlace - ASP.NET

I'm on VS 2008, Windows Xp. My page: <asp:Content runat="server" ContentPlaceHolderID="ContentPlaceHolder1"> <%= WriteReport()%> <%= "Hellooo" %> </asp:Content> Code-behind: public string WriteReport() { StringWriter swriter = new StringWriter(); using (HtmlTextWriter hwriter = new HtmlTextWriter(swriter)) { //Write a table... } return swriter.ToString(); } The funny thing is the "Heloo" goes in the contentPlace, but the method's return does no

Asp.net the importance of buffersize

While streaming big files (more than 150mb) with ASP.NET, to what should the buffersize be set? I use 16kb as default. Does making the buffersize bigger (for example 320kb) increase performance and decrease server load?

Asp.net How to convert binding value type into another in aspx?

I have this code: <asp:CheckBox ID="CheckBoxAppStatus" runat="server" Text="Done" Checked='<%# Bind("Status") %>'/> The problem is that Bind("Status") returns string (True/False), don't know why though it was defined as Boolean in the entity model. Is there a way to convert Bind("Status") into Boolean value and still using Bind (I need to edit this value not just show it and I think using Bind is the right way to do it automatically instead of doing it by C# code).

ASP.NET Postback User Not Logged in

OK I have a problem im not sure how to handle. I have an asp.net vb website with MSSQL on the backend. For every page, in the pre-init, it checks to see if the session("UserID") is logged in. If its logged in, it loads, if not, it brings you to the login page. One of my pages has a textarea that someone could spend 15 minutes writing in, after they are done, they hit save and it is suppossed to upload the data from the textarea to the database, which it does if they are logged in. Where I a

Asp.net Any in-framework way to prevent Cross Site Request Forgery (CSRF) within ASP .NET 4.0 (not MVC)?

Is there any in-framework way to prevent Cross Site Request Forgery (CSRF) within ASP .NET 4.0 Web forms based websites (not MVC)? I do see the framework generate __EVENTVALIDATION and __VIEWSTATE hidden form fields and I've encrypted them via machineKey and viewStateEncryptionMode="Always" in my web.config. However, it's not clear if they can actually prevent CSRF attacks. I tested a cross posting (via PostBackUrl in the form's asp:Button) form where I modified the __VIEWSTATE, __EVENTVALIDATIO

Asp.net Image not found in path after mvc3 app deployed within a virtual directory

Q: the following image won't resolve as referenced from a .js script (the js script in is ~/scripts with all the other .js scripts out of the mvc3 box) src: '/content/themes/base/images/down.gif' This works locally but will not when deployed remotely to an iis6.0 server as a virtual directory. I have tried: src: '~/content/themes/base/images/down.gif' but this wont' resolve locally or remotely. The following will work remotely if I hard code the virtual directory path (virtualdirectoryn

Asp.net Display message to user on ItemCommand event

I have grid in my ASP.NET page (actualy it's Telerik RadGrid). There is GridButtonColumn, and OnItemCommand event is called when user clicks the link in this cell. Right now, after user clicks, some data is prepared in the background and sent by e-mail. At the end of my method I want to display to user, that operation was succeeded. Any ideas, how can I reach that goal? I cannot use JavaScript in this event (there is no OnClick event or ClientScript property), and I want user to stay on curren

Asp.net How to pass GridView row to TemplateField function?

I have a GridView that has 3 columns: FirstName, LastName and a TemplateField FullName where I string together FirstName and LastName. Assuming calling DisplayFullName is the function I want to use to concatenate FirstName and LastName, how do I pass the row argument to the function and how to declare the parameter of the function? Thanks. Here's my code for the FullName column: <asp:TemplateField HeaderText="FullName"> <ItemTemplate> <%# Di

asp.net array / arraylist error

I'm working on something relatively simple (or so I thought) and need a bit of help. I am trying to create a dynamic amount of comma separated strings. I have a variable (numberOfStrings) which is the number of different strings I need. I just want to loop thru the aryDrivers and assign then to the different strings. Dim aryHeats(numberOfStrings - 1) As ArrayList Dim aryDrivers() As String aryDrivers = txtBatch.Text.Split(",") For i As Integer = 0 To aryDrivers.Length - 1 For j As Integ

Asp.net Page Redirection Issue using session Id

I have login page I am doing authentication using http handler to precompiled application. Already in the application sessions are used to redirect to a page after authentication. Please suggest me how can i redirect using session variable through http handlers in precompiled application. Note:i have no idea which session variable used.

Asp.net How to convert a label control to Image control?

In a datalist with templates I have 3 labels to store( firstname , scraps ,postedtime), image to store profile pic and one more image control to store a image in user posted a image as scrap. Now I want this image control visible only when user posted a image otherwise that row to invisible. code is protected void postscrap_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(); con.ConnectionString=ConnectionStrings["Con"].ConnectionS

Asp.net Can I specify a connection string in the web.debug.config only?

I have a group of apps that inherit their connection string from a web.config in the root directory of IIS. This means that I don't need to specify a connection string in the root directory of the app, but I do need to specify a connection string when debugging locally. My question is, how can I set a connection string in web.debug.config that only is used when I'm debugging?

Asp.net Why ispostback not working with dropdown box

I want to keep selected item after page reload: Excerpt from .aspx: <asp:DropDownList ID="MyDropDown" runat="server" AutoPostBack="true" onselectedindexchanged="MyDropDown_SelectedIndexChanged"> </asp:DropDownList> Exerpt from .cs in page_load if (!IsPostBack) { PopulateDropDownList(); } with private void PopulateDropDownList() { MyDropDown.Items.Add("1"); MyDropDown.Items.Add("2"); } prote

Asp.net Session lock and response.flush

Does Response.Flush have any affect on the session state of an application? For example, if the response is flushed then could the session lock be removed? I am experience what appears to be an occasional session collision as described in my question here: ASP.NET - Accessing web page twice from client. The session collision appears to occur on a web page, which flushes the response periodically.

Asp.net Add two role to a user and failed athentication

in my web site, i have three roles(Editor , Reviewer and Author) In some situations I need to add my user all 3 roles by coding. i use this code and it save all the users but. i can not log in with the user name and password. please guide me thanks. Membership.CreateUser(TextBox1.Text, "123456", "email"); Roles.AddUserToRole(TextBox1.Text, "Editor" ); Roles.AddUserToRole(TextBox1.Text, "Author"); Roles.AddUserToRole(TextBox1.Text, "Reviewer");

Asp.net Overzealous "Remember my Password" in Firefox

I had Firefox "remember my password" for my site, and I have a screen that allows me to create a new user, so it has inputs for username and password. These inputs are named something entirely different than what's on the login page, yet they are being filled in by Firefox. The same behavior does not happen in Chrome. Has anyone else experienced this? Login page: <label for="UserName">User name</label> <input id="UserName" type="text" name="UserName" data-val-required="The Us

Asp.net My website doesn't seem right in Internet Explorer

I have created a website (www.sebattoelisi.com) but I'm having a problem with Internet Explorer. The problem is (in Internet Explorer) when you open page for the first time, you can't see all of images and the border in DataList. Also when you click the products image page refreshes and images shows instead of go to that products page. Other browsers are fine. I'm not natural English speaker, if I made a mistake, sorry. Can you understand where the problem is?

Asp.net How do I convert and integer to datetime

I am using ASP.NET Visual Basic. I have an integer field in my database which I need to read as a date e.g. 20130813. But at the moment it says I cannot convert to datetime. Is there a way to split the integer up into DD, MM, YYYY so I could even store those in variables to then use to create a date. Or a simple way of just converting to date. Thanks for your time.

Asp.net IIS 8.5 Custom 404 not working for extensionless urls

I'm trying to set up custom 404 errors on IIS which needs to go to an ASPX page (404.aspx). If I browse the site and go to a nonexistant .aspx page (eg /not-here.aspx, the custom 404 page is used as expected. However if I go to an extensionless URL like /not-here then I just get IIS's own default 404 page served by the static content handler, rather than 404.aspx though ASP.NET IIS (8.5) is set to "Execute a URL on this site" which is set to /404.aspx How can I make IIS use the 404.aspx for

Asp.net Learning Resources for Entity Framework 5

My team is looking to shift asp.net form application from .NET 4 to .NET 4.5. We are hoping that we would be able to use the whole new Entity Framework 5. Being the in charge of this task I did look into the advantages of using EF5 and I am quite impressed. EF5 gives you the ability to run pre-compiled Queries and that will be a great performance boost. Apart from that we would be able to use enums and table-valued functions, that I am not very excited about but lets see how these can improv

Interactive asp.net page to import files into ms sql server

Any ideas on how to create the asp.net page for loading flat files into sql server. User would select database from dropdown, enter table name to create, browse to layout file that has field names and lengths, browse to data file for loading and enter type of data file format and check whether it has a header record or not. When you click on Import File button, it will import the data file into MS SQL Server.

Convert a String to Call a Public Class ASP.NET VB

I have looked at this link and I cannot seem to get it to work Creating a New control of the same type as another control that is already declared I have also tried this from searches: Dim ClassToCreate As String = "TestClass1.CountItems" Dim myInstance = Activator.CreateInstance(Type.GetType(ClassToCreate), True) Error is: "Value cannot be null. Parameter name: type" Problem: I have multiple classes and want to change which one is called based on a string. (example is not correct of co

Asp.net Authentication as two different users when connecting to IIS7

I apologize if I completely bungle this question and description. I have a test and production asp.net application both using windows authentication. They are the same build but for some reason, on my development machine, the test application has started authenticating me as domain\user1 while the production application authenticates me as domain\user2 who I am logged in as. If I try a different machine, both the test and production applications authenticate me as domain\user2 as expected. T

Asp.net ASP NET error when having 2 concurrent user access the same method / function

I got problem while implementing ASP NET. Here is my code Dim submitThread As Thread = New Thread(AddressOf submit_thread) submitThread.Priority = ThreadPriority.Normal submitThread.Start() inside submit_thread function there are long looping method in local variables. When only 1 user hit the button, it works well and that method completed is less then 1 second. But the problem occur when 2 users hit / execute the method at the same time. 1 user will succeed and the other with

ASP.NET Load Balancing on IIS

I have two application servers(IIS, ASP.NET), they are connected by Ethernet, one of them has a dedicated IP address. Each of them receives data, makes calculations, and then sends the response back. The load on them will be small, about 30-40 users. So, I have two questions. IIS plugin Application Request Routing is well suited for this configuration? Can I use a balancer on one of the compute servers or is it better to dedicate a separate machine for it?

ASP.NET ActiveDirectoryMembershipProvider asking for smartcard

I am using Forms Authentication with ActiveDiretoryMembershipProvider and ASP.NET Login-Control. The problem occurs while testing locally with IIS Express. When I first enter credentials no immediate redirect happens but instead a window asking for a smartcard repeatedly pops up. Closing this window will eventually lead to a succesful login. This happens only the first time I call Membership.ValidateUser() after application start. Subsequent logins don't cause it. Stepping through the ActiveD

Asp.net Ajax call to Microsoft SQL Server

I have created few textboxes and Images with unique IDs in my .aspx file. I need to update these items every 5 seconds through an ajax call to my Microsoft SQL Server database. Details of values to be displayed in all textboxes and dynamic images are stored in separate views. Currently I am refreshing the page every 5 seconds but it is not economical as the fetch phenomena of every images either static or dynamic is causing too much bandwidth load to the network. Thanks in advance.

Asp.net publish web app using iis locally - SCREEN BLANK

I followed this guide using Visual Studio to publish my web app using IIS LOCALLY... skipping the database section for now. http://www.asp.net/mvc/overview/deployment/visual-studio-web-deployment/deploying-to-iis Visual studio published successfully, then it automatically opened up a webpage http://localhost/ExtApplication4/ The problem is the webpage opens up blank on same computer. I am also attached the dev tools but I don't know what to look for to see WHY nothing is being displayed. C

Asp.net MSBuild in VSTS deploy web app on root

I am trying to Continuous Delivery my ASP.NET WEB API 2 app with Visual Studio Team Services (VSTS). I created Release with Deploy Azure App Service task with default settings (i changed only Package or Folder field to match my bin\Release folder) Build and deploy were successful, but nothing changed. When I open DebugConsole/CMD in Diagnostic Console (app-name.scm.azurewebsites.net) I saw that VSO put all binaries to the ...\wwwroot, while Visual Studio puts all binaries to ...\wwwroot\bin fo

ASP.Net Core 2.0 - ResponseCaching Middleware - Not Caching on Server

I want to use server-side response caching (output cache) with asp.net core 2.0 and found out about Response Caching Middleware and wanted to give it a try with a brand new asp.core mvc project. Here is the description from the link above which makes me think this could be used like output cache. The middleware determines when responses are cacheable, stores responses, and serves responses from cache. Here is how my startup.cs looks like. public class Startup { public Startup(IConfi

Asp.net How to remove HTML tags from JSON response

For admins: I have checked similar topics here but unfortunatelly I didn't find an answer. I'm trying to delete all html tags from http GET response. I have a controller written in ASP.NET MVC which calls a database procedures. These procedures return json where html tags are present. An application is written in Angular4 framework. I consider what is the best place to strip all html tags and replace them with this tags: & --> &amp; < --> &lt; > --> &gt; " -

how to configure hdiv with asp.net mvc 5

I'm working on an enterprise web project for our government but the important phase is it's security. I heard something about HDIV that secure our websites. but I don't know how to configure/integrate it with our web application. if anyone can help I will be very thankful. or suggest me some other web application security frameworks for ASP.NET MVC 5 apps.

  1    2   3   4   5   6  ... 下一页 最后一页 共 638 页