Vb.net - Only Allow Certain Ip Range To Webpage?

Dec 6, 2010

in my asp code i was using

<%
UserIPAddress = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
If UserIPAddress = "" Then
UserIPAddress = Request.ServerVariables("REMOTE_ADDR")
end if
IF Left(UserIPAddress,11) = "111.111.111" or Left(UserIPAddress,10) = "444.444.44" then
%>

how could i do something like this in asp.net(using vb.net)

View 1 Replies


Similar Messages:

Range Validator Failing / If Enter Value 450 In Textbox To Validate It In Range 25 To 50

Apr 30, 2010

I am facing problem using range validator.

Like in code below

[code]

If I enter value 450 in textbox to validate it in range 25 to 50 ,it won't give any error message

View 1 Replies

Range Validator - Alphabet Entered When Integer Range Checked

Sep 23, 2010

I have a Range Validator as follows. It is for restricting values between 1900 and 2070. However, it fires error when I enter a alphabet also. I want this to be fired only if the user enters integer values. How do I overcome it?

<asp:RangeValidator ID="RangeValidator1" runat="server" ControlToValidate="txtYear"
ValidationGroup="report" ErrorMessage="EM1|Year" MaximumValue="2079" MinimumValue="1900"
SetFocusOnError="True" Display="Dynamic" Type="Integer">
<img src="../../Images/error.gif" alt="Format" />
</asp:RangeValidator>

View 1 Replies

Web Forms :: When Using A Range Validator, If The User Exceeds The Defined Range?

Jan 1, 2010

When using a range validator, if the user exceeds the defined range, How do you code it so it disables a button so the user can't continue. (without using JavaScript)

View 3 Replies

Check The Range And Number Of Records In That Range Without Using Cursor?

Jan 13, 2010

I have a table "RANGES" with the following columns

LowRange as int
HighRange as int
with the data similar to below
select * from Ranges
LowRange HighRange
1 100
101 200
201 300
.
.
.
901 1000

And another table "infoDetails" with the following columns

Range as INT
amount as money
with the data similar to below
select * from infoDetails
Range Amount
23 34.00
235 44.00
345 34.00
678 100.00
555 100.00
530 100.00
510 100.00
I need one report with the following format without cursor.
LowRange HighRange Count Amount
1 100 1 34.00
101 200 0 0.00
.
.
501 600 3 300.00
601 700 1 100.00

View 1 Replies

Web Forms :: Range Validator Not Working For Specified Integer Range

Dec 11, 2012

I want to validate textbox, so user enter greater than 30

if user enter lessthan 30 than message will display.. for that i use range validator of asp.net

<asp:TextBox ID="txtprice" runat="server" CssClass="textbox" Width="180px"></asp:TextBox>
<asp:RangeValidator runat="server" Display="None" ID="range1" ValidationGroup="grdsave"
SetFocusOnError="true" ControlToValidate="txtPrice" MinimumValue="30" MaximumValue="999"
ErrorMessage="Minimun budget is 30 USA dollor"></asp:RangeValidator>
 
It give message if i enter less than 30. but if i enter 100 or 200 it also give message. How can i allow that value?

View 1 Replies

Crystal Reports :: How To Pass Date Range From Text Box To Crystal Date Range Parameter

Sep 25, 2010

I has developed a crystal report, which display the records from a table and filters them based on a parameter( date range parameter). now I has integrated the report into a asp.net page using c#, but when I am running the asp page it is not promption for the date range values, it used to prompt for date range when I run the report in crystal report.

View 2 Replies

JQuery :: Put A Fixed Range On A Jquery Range Slider (2 - Handled Slider)

Aug 3, 2010

I put a jquery range slider (a 2-handled slider) on a page and am able to access its two values as needed. Works like a champ! The requirements just changed - now the range needs to be fixed. So as one handle slides, the other needs to slide with it. Or at least re-position itself after the other slider is dropped into it new position. Does that make sense? I'm still really weak with javascript, so go gently with me

View 4 Replies

Web Forms :: Whenever Click On Any Button On Webpage, The Request Goes Through, But Nothing Show Up On The Webpage?

Dec 17, 2010

I am working on a financial portal and I am having a problem..I don;t know what to call it so i mentioned it as an 'unknown to me' problem..I have a webpage..whenever I click on any button on my webpage, the request goes through..but nothing show up on the webpage..then If I click on another link and then again come back to previous link,then only I see the results of button_click..

e.g.

I have a currency conversion and investment form..so after filling up the form in following way and if I click on "INVEST" then nothing shows up..

so now if i click on any other link and go back to 'buy currency' link I see the result as 'investment successful'

View 3 Replies

Php - How To Embed The Result Of A Webpage Into Another Webpage On Another Website

Mar 23, 2010

I would like to allow users to call my ruby on rails app as a service which returns a 'div' with html content in it, and embed that div into their app (which will not be a rails application).

For example, assume someone has their own php website that has a header/footer template that gets rendered, and a content area of the page that they need to fill based on some html I generate in my rails app. I would like to allow them, from php, to call to my website, get the 'div' I generate, and embed that as html in their php page.

What I'm trying to do is host a service on my site that returns some html content, but actually show that content as part of another site, so that the end user only sees the other site and never really knows about mine.

Also, I can use javascript on the client to do this if that is the only way, but I would prefer the php app to handle this at the server if possible so the client gets the html embedded from the original server and it looks like it all was generated by the php script that generated the entire page. I also want to avoid using an iframe.

View 3 Replies

Web Forms :: Displaying One Webpage Content In Another Webpage?

Apr 24, 2010

I developed an application form which includes some textboxes for input. When the user click on the button the following tasks has to be done.

1) If page is valid all data should be stored in database

2) A new webform should appear on the same window and the some content of the application form should be displayed in it.

3) When clicking on browser back button it should not post back to previous page.....

I did the first task..and i don't know the code for the remaining tasks. Here is some information

.aspx button control code

[code]....

I opened new webform by using Response.Redirect ("submit.aspx"). Where submit.aspx is the form to be opened after data stored upon the button click in application form.

View 9 Replies

Security :: Get URL Of The Webpage That Referred The Request To Webpage?

Aug 17, 2010

am trying to get URL of the page that referred the request to my page, i tried the "

[Code]....

[Code]....

[Code]....

[Code]....

View 5 Replies

C# - Index Was Out Of Range

Feb 21, 2010

I get the index out of range exception when compiling my grid view to display a set of orders. It doesn't happen when I add a new row but it does occur when I try to delete or update a row. The designer is:

<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataKeyNames=""
OnRowCancelingEdit="GridView1_RowCancelingEdit"
OnRowEditing="GridView1_RowEditing"
OnRowUpdating="GridView1_RowUpdating"
OnRowCommand="GridView1_RowCommand"
ShowFooter="True"
OnRowDeleting="GridView1_RowDeleting">
<Columns>
<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:Button ID="Button1" runat="server" CausesValidation="True" CommandName="Update" Text="Update" />
<asp:Button ID="Button2" runat="server" CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate>
<ItemTemplate>
<asp:Button ID="editButton" runat="server" CausesValidation="False" CommandName="Edit" Text="Edit" />
</ItemTemplate>
<FooterTemplate>
<asp:Button ID="LinkButton2" runat="server" CausesValidation="False" CommandName="AddNew" Text="Add New"></asp:Button>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order ID">
<EditItemTemplate>
<asp:TextBox ID="txtOrderID" runat="server" Text='<%# Bind("OrderID") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderID" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("OrderID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<EditItemTemplate>
<asp:TextBox ID="txtDate" runat="server" Text='<%# Bind("Date") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDate" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("Date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order Taken by">
<EditItemTemplate>
<asp:TextBox ID="txtOrderTaker" runat="server" Text='<%# Bind("OrderTaker") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderTaker" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("OrderTaker") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Order By">
<EditItemTemplate>
<asp:TextBox ID="txtOrderBy" runat="server" Text='<%# Bind("OrderBy") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewOrderBy" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("OrderBy") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Lens Material">
<EditItemTemplate>
<asp:TextBox ID="txtMaterial" runat="server" Text='<%# Bind("Material") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewMaterial" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%# Bind("Material") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Tint">
<EditItemTemplate>
<asp:TextBox ID="txtTint" runat="server" Text='<%# Bind("Tint") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewTint" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%# Bind("Tint") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BCOR">
<EditItemTemplate>
<asp:TextBox ID="txtBCOR" runat="server" Text='<%# Bind("BCOR") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewBCOR" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%# Bind("BCOR") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Power">
<EditItemTemplate>
<asp:TextBox ID="txtPower" runat="server" Text='<%# Bind("Power") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewPower" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%# Bind("Power") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Diameter">
<EditItemTemplate>
<asp:TextBox ID="txtDiameter" runat="server" Text='<%# Bind("Diameter") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDiameter" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="LabelDiameter" runat="server" Text='<%# Bind("Diameter") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Design">
<EditItemTemplate>
<asp:TextBox ID="txtDesign" runat="server" Text='<%# Bind("Design") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewDesign" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label9" runat="server" Text='<%# Bind("Design") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Notes">
<EditItemTemplate>
<asp:TextBox ID="txtNotes" runat="server" Text='<%# Bind("Notes") %>'></asp:TextBox>
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtNewNotes" runat="server" TextMode="MultiLine"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Label10" runat="server" Text='<%# Bind("Notes") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField HeaderText="Delete" ShowDeleteButton="True" ShowHeader="True" />
</Columns>
</asp:GridView>
The code-behind is:
public class LensOrdersCls
{
private string cnstr = ConfigurationManager.ConnectionStrings["PatientConnectionString"].ConnectionString;
private string sql;
public LensOrdersCls()
{
//
// TODO: Add constructor logic here
//
}
public void Insert(int OrderID, string Date, string OrderTaker, string OrderBy, string Material, string Tint, string BCOR, string Power, string Diameter, string Design, string Notes)
{
string sql = "Insert Into LensOrders (OrderID, Date, OrderTaker, OrderBy, Material, Tint, BCOR, Power, Diameter, Design, Notes) Values ('" + OrderID
+ "' , '" + Date + "', '" + OrderTaker + "', '" + OrderBy + "', '" + Material + "' , '" + Tint + "' , '" + BCOR + "' , '" + Power + "', '" + Diameter + "', '" + Design + "', '" + Notes + "')";
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
public DataTable Fetch()
{
string sql = "Select * From LensOrders";
SqlDataAdapter da = new SqlDataAdapter(sql, cnstr);
DataTable dt = new DataTable();
da.Fill(dt);
return dt;
}
public void Update(int OrderID, string Date, string OrderTaker, string OrderBy, string Material, string Tint, string BCOR, string Power, string Diameter, string Design, string Notes)
{
string sql = "UPDATE LensOrders SET OrderID='" + OrderID + "', Date = '" + Date
+ "', OrderTaker='" + OrderTaker + "', OrderBy = '" + OrderBy + "' Material=" + Material + "' Tint= '" + Tint + "' BCOR= '" + BCOR + "' Power '" + Power + "' Diameter= '" + Diameter + "' Design= '" + Design + "' Notes= '" + Notes;
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
public void Delete(int OrderID)
{
string sql = "Delete LensOrders Where OrderID=" + OrderID;
SqlConnection conn = new SqlConnection(cnstr);
conn.Open();
SqlCommand cmd = new SqlCommand(sql, conn);
cmd.ExecuteNonQuery();
conn.Close();
conn.Dispose();
}
}
The page code-behind is:
public partial class Default : System.Web.UI.Page
{
LensOrdersCls LensOrder = new LensOrdersCls();
private void FillOrdersInGrid()
{
DataTable dtOrder = LensOrder.Fetch();
if (dtOrder.Rows.Count > 0)
{
GridView1.DataSource = dtOrder;
GridView1.DataBind();
}
else
{
dtOrder.Rows.Add(dtOrder.NewRow());
GridView1.DataSource = dtOrder;
GridView1.DataBind();
int TotalColumns = GridView1.Rows[0].Cells.Count;
GridView1.Rows[0].Cells.Clear();
GridView1.Rows[0].Cells.Add(new TableCell());
GridView1.Rows[0].Cells[0].ColumnSpan = TotalColumns;
GridView1.Rows[0].Cells[0].Text = "No Record Found";
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillOrdersInGrid();
test.Text = GridView1.Rows[0].Cells.Count.ToString();
}
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName.Equals("AddNew"))
{
TextBox txtNewOrderID = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderID");
TextBox txtNewDate = (TextBox)GridView1.FooterRow.FindControl("txtNewDate");
TextBox txtNewOrderTaker = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderTaker");
TextBox txtNewOrderBy = (TextBox)GridView1.FooterRow.FindControl("txtNewOrderBy");
TextBox txtNewMaterial = (TextBox)GridView1.FooterRow.FindControl("txtNewMaterial");
TextBox txtNewTint = (TextBox)GridView1.FooterRow.FindControl("txtNewTint");
TextBox txtNewBCOR = (TextBox)GridView1.FooterRow.FindControl("txtNewBCOR");
TextBox txtNewPower = (TextBox)GridView1.FooterRow.FindControl("txtNewPower");
TextBox txtNewDiameter = (TextBox)GridView1.FooterRow.FindControl("txtNewDiameter");
TextBox txtNewDesign = (TextBox)GridView1.FooterRow.FindControl("txtNewDesign");
TextBox txtNewNotes = (TextBox)GridView1.FooterRow.FindControl("txtNewNotes");
LensOrder.Insert(Convert.ToInt32(txtNewOrderID.Text),
txtNewDate.Text,
txtNewOrderTaker.Text,
txtNewOrderBy.Text,
txtNewMaterial.Text,
txtNewTint.Text,
txtNewBCOR.Text,
txtNewPower.Text,
txtNewDiameter.Text,
txtNewDesign.Text,
txtNewNotes.Text);
FillOrdersInGrid();
}
}
// Row Editing
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
GridView1.EditIndex = e.NewEditIndex;
FillOrdersInGrid();
}
// Row Cancel editing
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
GridView1.EditIndex = -1;
FillOrdersInGrid();
}
//Row updating
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
TextBox txtOrderID = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtOrderID");
TextBox txtDate = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDate");
TextBox txtOrderTaker = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtOrderTaker");
TextBox txtOrderBy = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtNewOrderBy");
TextBox txtMaterial = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtMaterial");
TextBox txtTint = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtTint");
TextBox txtBCOR = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtBCOR");
TextBox txtPower = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtPower");
TextBox txtDiameter = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDiameter");
TextBox txtDesign = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtDesign");
TextBox txtNotes = (TextBox)GridView1.Rows[e.RowIndex].FindControl("txtNotes");
LensOrder.Update(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()),
txtDate.Text,
txtOrderTaker.Text,
txtOrderBy.Text,
txtMaterial.Text,
txtTint.Text,
txtBCOR.Text,
txtPower.Text,
txtDiameter.Text,
txtDesign.Text,
txtNotes.Text);
GridView1.EditIndex = -1;
FillOrdersInGrid();
}
//Deleting row
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LensOrder.Delete(Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Values[0].ToString()));
FillOrdersInGrid();
}
}

View 1 Replies

Regex For Integer Range

Jul 26, 2010

how i can implemnt a regex that cover integer range? means from 0 to 2147483647

View 9 Replies

Set A Dateformat Dd/mm/yy For Range Validator?

Jan 20, 2011

I have a range validator to validate a textbox for birthday. i must ensure that a student must be above 21 to register with us. i set "31/12/1993" format (dd/mm/yy).

but it cannot run the website as in my database is set to this (mm/dd/yy) format. how can i solve this without changing my database format? so that it can function for everyone.

View 2 Replies

Play The Range Of Big Wmv Files By Using C#?

Jan 14, 2010

I am developing a ASP.NET by using c#.net and have many WMV files and have to watch the range of the file which I gave.The size of files are too big also the users shouldn't download the all of the file , should download between the range which I give .

View 1 Replies

Regular Expression For A Range And -1?

Jan 24, 2011

I am trying to write a Regular Expression Validator to allow users to input any number (either positive or negative), except 0. I tried the followings but obviously they failed:

^[1-9-]{1,10}$ <= failed when the 2nd to n-th digit is 0

^d+$ <= failed to treat negative numbers as valid

View 6 Replies

Web Forms :: Date Range From Two Textboxes?

May 3, 2010

I am trying two calculate a date range from two textboxes. I currently have:

[Code]....

the date in textbox1 comes from cdrcalendar. I need to include cdrcalendar2 somewhere. Something along the line of "with cdrCalendar.SelectedDates and with cdrCalendar2.SelectedDates".

View 5 Replies

Get Count Of Certain Date Range Into Label

Feb 4, 2010

I am trying to do this form that counts the number of records that are completed in a certain date range. I just want the user to place his date range and have it return the count as a Label. Here's what I have so far, I'm not 100% sure how to correctly place the user inputed variables into the Query.

It keeps returning "System.Data.SqlClient.SqlCommand"

[Code]....

View 11 Replies

Calculating Date Range For A Certain Period?

Mar 11, 2011

I have a dropdownlist having values 'today','yesterday',lastweek', 'last month', 'lastyear'.

when the user select any value from this dropdown, i want to show the from date and to date in two text boxes.

e.g. if the user selects last week, 'to date' should be today's date and 'from date' should be (today's date - 7). if current date is 12, 'from date' = 6 and 'to date' = 12

How do I do this?

View 3 Replies

Web Forms :: How To Check Min And Max Value Using Range Validator

Dec 17, 2010

Range validator ..

I have a text box , i need to check restrict user to enter minimum 5 character and maximum 50 character using range validator.

View 3 Replies

Filter By Date Range In ASPxPivotGrid?

Jan 6, 2011

I am using an ASPxPivotGrid to display order data in an aspx website. When I put a column in the "filter area" that has a date value, it displays a checked list of dates to choose from (see below). Is there a setting or workaround to get it to show a date-range or calendar popup to filter by?

View 1 Replies

Check Ip Address Against A Range Of Values Using C#?

Dec 14, 2010

We are writing a feature that allows an administrator to block/allow ranges of ip addresses.

Is this easy enough to do with c#?

I was thinking of looking at each number [here].[here].[here].[here] and then mathing it with the ranges and just seeing if each number was between the two?

Will that work for standard ip v4 addresses?

View 4 Replies

Using Required And Range Validator But Not Working?

Dec 2, 2010

I have created one page where i am using Required and Range Validator and i am using java script also. But it is not working.And when i am trying only validator it is working. How should i run both the things

View 3 Replies

JQuery :: Validate The Range Of Number?

Sep 13, 2010

How to Validate the Range of Number

[Code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved