<system.web>
<urlMappings enabled="true">
<add
url="~/Clubs/Computer Club.aspx"
mappedUrl="~/ShowPage.aspx?PageID=1" />
<add
url="~/Clubs/Eco Club.aspx"
mappedUrl="~/ShowPage.aspx?PageID=2" />
</urlMappings >
</system.web>
ASP.NET with C# and SQL SERVER , some vb.net . asp.net examples, asp.net codes, asp.net programs, c# code, sql server queries, important codes.
Saturday, 15 June 2013
url mapping in c# asp.net
----------------------------------------
IN WEB Config...........>
---------------------------------------------
<urlMappings enabled="true">
<add url="~/operatorlogin.aspx" mappedUrl="~/adminlogin.aspx?id=op"/>
<add url="~/adminlogin.aspx" mappedUrl="~/adminlogin.aspx"/>
<add url="~/superadmin.aspx" mappedUrl="~/adminlogin.aspx?id=sa"/>
<add url="~/accounts.aspx" mappedUrl="~/adminlogin.aspx?id=ac"/>
</urlMappings>
</system.web>
---------------------------------------------------
viewstate in asp.net c#
------------------------------------
ViewState["a"] = txt_password.Text;
----------------------------------
------------------------------------
password = ViewState["a"].ToString();
------------------------------------
validation in asp.net c# , REQUIREDFIELD VALIDATOR,COMPARE VALIDATOR,RANGE VALIDATOR,RAGULAREXPRESSION VALIDATOR
============================================================================================
*******************************
REQUIREDFIELD VALIDATOR:-->
******************************
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="txtUsername"
Text="Required!"
Runat="Server" />
<b>Password</b>
<br />
<asp:TextBox
ID="txtPassword"
Maxlength="20"
TextMode="Password"
CssClass="formfield"
Runat="Server" />
-------------------------------------------------------------------------------
**************************
COMPARE VALIDATOR:-->
**************************
<asp:CompareValidator ID="CompareValidator1"
ControlToValidate = "txtPassword"
ControlToCompare = "txtPassword2"
Type = "String"
Operator="Equal"
Text="Passwords must match!"
Runat = "Server" />
-------------------------------------------------------------------------------
**************************
RANGE VALIDATOR:-->
**************************
<asp:TextBox ID="txtQty"
MaxLength="15" runat="server" />
<asp:RangeValidator
id="ValQty"
Type="Integer"
Text="Qty should be enter between 100 and 1000"
ControlToValidate="txtQty"
MaximumValue="1000"
MinimumValue="100"
runat="server"/>
----------------------------------------------------------------------------------
*********************************
RAGULAREXPRESSION VALIDATOR:-->
*********************************
For (E-Mail)
<asp:regularexpressionvalidator
id="RegularExpressionValidator1"
runat="server"
xmlns:asp="#unknown">
ControlToValidate="txtEmail"
ErrorMessage="Invalid Email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
For (Phone)
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1"ErrorMessage="Enter only Numbers"
ValidationExpression="[0-9]*">
</asp:RegularExpressionValidator>
For (Mobile No)
^([9]{1})([02346789]{1})([0-9]{8})$
-----------------------------------------------------------------------------------
^\d+$ (---for Numbers Only---)
-----------------------------------------------------------------------------------
^[-+]?[0-9]*\.?[0-9]+$ (---for Putting number with or without decimal---)
===========================================================================================
*******************************
REQUIREDFIELD VALIDATOR:-->
******************************
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
ControlToValidate="txtUsername"
Text="Required!"
Runat="Server" />
<b>Password</b>
<br />
<asp:TextBox
ID="txtPassword"
Maxlength="20"
TextMode="Password"
CssClass="formfield"
Runat="Server" />
-------------------------------------------------------------------------------
**************************
COMPARE VALIDATOR:-->
**************************
<asp:CompareValidator ID="CompareValidator1"
ControlToValidate = "txtPassword"
ControlToCompare = "txtPassword2"
Type = "String"
Operator="Equal"
Text="Passwords must match!"
Runat = "Server" />
-------------------------------------------------------------------------------
**************************
RANGE VALIDATOR:-->
**************************
<asp:TextBox ID="txtQty"
MaxLength="15" runat="server" />
<asp:RangeValidator
id="ValQty"
Type="Integer"
Text="Qty should be enter between 100 and 1000"
ControlToValidate="txtQty"
MaximumValue="1000"
MinimumValue="100"
runat="server"/>
----------------------------------------------------------------------------------
*********************************
RAGULAREXPRESSION VALIDATOR:-->
*********************************
For (E-Mail)
<asp:regularexpressionvalidator
id="RegularExpressionValidator1"
runat="server"
xmlns:asp="#unknown">
ControlToValidate="txtEmail"
ErrorMessage="Invalid Email"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">
For (Phone)
<asp:TextBox ID="TextBox1" runat="server">
</asp:TextBox>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ControlToValidate="TextBox1"ErrorMessage="Enter only Numbers"
ValidationExpression="[0-9]*">
</asp:RegularExpressionValidator>
For (Mobile No)
^([9]{1})([02346789]{1})([0-9]{8})$
-----------------------------------------------------------------------------------
^\d+$ (---for Numbers Only---)
-----------------------------------------------------------------------------------
^[-+]?[0-9]*\.?[0-9]+$ (---for Putting number with or without decimal---)
===========================================================================================
Validation Expressions in c#
------------------------------------------------------------------------------
Validation Expressions
These are so often hard to find so I am posting them here:
Metacharacter Match
\ the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. (period) match any character except newline
x match any instance of x
^x match any character except x
[x] match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| (pipe) an OR operator - [x|y] will match an instance of x or y
() used to group sequences of characters or matches
{} used to define numeric quantifiers
{x} match must occur exactly x times
{x,} match must occur at least x times
{x,y} match must occur at least x times, but no more than y times
? preceding match is optional or one only, same as {0,1}
* find 0 or more of preceding match, same as {0,}
+ find 1 or more of preceding match, same as {1,}
^ match the beginning of the line
$ match the end of a line
POSIX Class Match
[:alnum:] alphabetic and numeric characters
[:alpha:] alphabetic characters
[:blank:] space and tab
[:cntrl:] control characters
[:digit:] digits
[:graph:] non-blank (not spaces and control characters)
[:lower:] lowercase alphabetic characters
[:print:] any printable characters
[:punct:] punctuation characters
[:space:] all whitespace characters (includes [:blank:], newline, carriage return)
[:upper:] uppercase alphabetic characters
[:xdigit:] digits allowed in a hexadecimal number (i.e. 0-9, a-f, A-F)
Character class Match
\d matches a digit, same as [0-9]
\D matches a non-digit, same as [^0-9]
\s matches a whitespace character (space, tab, newline, etc.)
\S matches a non-whitespace character
\w matches a word character
\W matches a non-word character
\b matches a word-boundary (NOTE: within a class, matches a backspace)
\B matches a non-wordboundary
\
The backslash escapes any character and can therefore be used to force characters to be matched as literals instead of being treated as characters with special meaning. For example, '\[' matches '[' and '\\' matches '\'.
.
A dot matches any character. For example, 'go.d' matches 'gold' and 'good'.
{ }
{n} ... Match exactly n times
{n,} ... Match at least n times
{n,m} ... Match at least n but not more than m times
[ ]
A string enclosed in square brackets matches any character in that string, but no others. For example, '[xyz]' matches only 'x', 'y', or 'z', a range of characters may be specified by two characters separated by '-'. Note that '[a-z]' matches alphabetic characters, while '[z-a]' never matches.
[-]
A hyphen within the brackets signifies a range of characters. For example, [b-o] matches any character from b through o.
|
A vertical bar matches either expression on either side of the vertical bar. For example, bar|car will match either bar or car.
*
An asterisk after a string matches any number of occurrences of that string, including zero characters. For example, bo* matches: bo, boo and booo but not b.
+
A plus sign after a string matches any number of occurrences of that string, except zero characters. For example, bo+ matches: boo, and booo, but not bo or be.
\d+
matches all numbers with one or more digits
\d*
matches all numbers with zero or more digits
\w+
matches all words with one or more characters containing a-z, A-Z and 0-9. \w+ will find title, border, width etc. Please note that \w matches only numbers and characters (a-z, A-Z, 0-9) lower than ordinal value 128.
[a-zA-Z\xA1-\xFF]+
matches all words with one or more characters containing a-z, A-Z and characters larger than ordinal value 161 (eg. ä or Ü). If you want to find words with numbers, then add 0-9 to the expression: [0-9a-zA-Z\xA1-\xFF]+
Typical examples
(bo*)
will find "bo", "boo", "bot", but not "b"
(bx+)
will find "bxxxxxxxx", "bxx", but not "bx" or "be"
(\d+)
will find all numbers
(\d+ visitors)
will find "3 visitors" or "243234 visitors" or "2763816 visitors"
(\d+ of \d+ messages)
will find "2 of 1200 messages" or "1 of 10 messages"
(\d+ of \d+ messages)
will filter everything from the last occurrence of "2 of 1200 messages" or "1 of 10 messages" to the end of the page
(MyText.{0,20})
will find "MyText" and the next 20 characters after "MyText"
(\d\d.\d\d.\d\d\d\d)
will find date-strings with format 99.99.9999 or 99-99-9999 (the dot in the regex matches any character)
(\d\d\.\d\d\.\d\d\d\d)
will find date-strings with format 99.99.9999
(([_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+))
will find all e-mail addresses
Validation Expressions
These are so often hard to find so I am posting them here:
Metacharacter Match
\ the escape character - used to find an instance of a metacharacter like a period, brackets, etc.
. (period) match any character except newline
x match any instance of x
^x match any character except x
[x] match any instance of x in the bracketed range - [abxyz] will match any instance of a, b, x, y, or z
| (pipe) an OR operator - [x|y] will match an instance of x or y
() used to group sequences of characters or matches
{} used to define numeric quantifiers
{x} match must occur exactly x times
{x,} match must occur at least x times
{x,y} match must occur at least x times, but no more than y times
? preceding match is optional or one only, same as {0,1}
* find 0 or more of preceding match, same as {0,}
+ find 1 or more of preceding match, same as {1,}
^ match the beginning of the line
$ match the end of a line
POSIX Class Match
[:alnum:] alphabetic and numeric characters
[:alpha:] alphabetic characters
[:blank:] space and tab
[:cntrl:] control characters
[:digit:] digits
[:graph:] non-blank (not spaces and control characters)
[:lower:] lowercase alphabetic characters
[:print:] any printable characters
[:punct:] punctuation characters
[:space:] all whitespace characters (includes [:blank:], newline, carriage return)
[:upper:] uppercase alphabetic characters
[:xdigit:] digits allowed in a hexadecimal number (i.e. 0-9, a-f, A-F)
Character class Match
\d matches a digit, same as [0-9]
\D matches a non-digit, same as [^0-9]
\s matches a whitespace character (space, tab, newline, etc.)
\S matches a non-whitespace character
\w matches a word character
\W matches a non-word character
\b matches a word-boundary (NOTE: within a class, matches a backspace)
\B matches a non-wordboundary
\
The backslash escapes any character and can therefore be used to force characters to be matched as literals instead of being treated as characters with special meaning. For example, '\[' matches '[' and '\\' matches '\'.
.
A dot matches any character. For example, 'go.d' matches 'gold' and 'good'.
{ }
{n} ... Match exactly n times
{n,} ... Match at least n times
{n,m} ... Match at least n but not more than m times
[ ]
A string enclosed in square brackets matches any character in that string, but no others. For example, '[xyz]' matches only 'x', 'y', or 'z', a range of characters may be specified by two characters separated by '-'. Note that '[a-z]' matches alphabetic characters, while '[z-a]' never matches.
[-]
A hyphen within the brackets signifies a range of characters. For example, [b-o] matches any character from b through o.
|
A vertical bar matches either expression on either side of the vertical bar. For example, bar|car will match either bar or car.
*
An asterisk after a string matches any number of occurrences of that string, including zero characters. For example, bo* matches: bo, boo and booo but not b.
+
A plus sign after a string matches any number of occurrences of that string, except zero characters. For example, bo+ matches: boo, and booo, but not bo or be.
\d+
matches all numbers with one or more digits
\d*
matches all numbers with zero or more digits
\w+
matches all words with one or more characters containing a-z, A-Z and 0-9. \w+ will find title, border, width etc. Please note that \w matches only numbers and characters (a-z, A-Z, 0-9) lower than ordinal value 128.
[a-zA-Z\xA1-\xFF]+
matches all words with one or more characters containing a-z, A-Z and characters larger than ordinal value 161 (eg. ä or Ü). If you want to find words with numbers, then add 0-9 to the expression: [0-9a-zA-Z\xA1-\xFF]+
Typical examples
(bo*)
will find "bo", "boo", "bot", but not "b"
(bx+)
will find "bxxxxxxxx", "bxx", but not "bx" or "be"
(\d+)
will find all numbers
(\d+ visitors)
will find "3 visitors" or "243234 visitors" or "2763816 visitors"
(\d+ of \d+ messages)
will find "2 of 1200 messages" or "1 of 10 messages"
(\d+ of \d+ messages)
will filter everything from the last occurrence of "2 of 1200 messages" or "1 of 10 messages" to the end of the page
(MyText.{0,20})
will find "MyText" and the next 20 characters after "MyText"
(\d\d.\d\d.\d\d\d\d)
will find date-strings with format 99.99.9999 or 99-99-9999 (the dot in the regex matches any character)
(\d\d\.\d\d\.\d\d\d\d)
will find date-strings with format 99.99.9999
(([_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+))
will find all e-mail addresses
validations in javascript
*********** Number & Character Validations******************
--------------------------------------------------------------------------------------
<script language ="javascript " type ="text/javascript">
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode
if (charCode > 31 && (charCode < 48 || charCode > 57))
return false;
}
function isCharKey(evt)
{
var charCode=(evt.which)? evt.which : evt.keyCode;
if (charCode>=48 && charCode <=57)
return false;
}
</script>
--------------------------------------------------------------------------------------
<asp:TextBox ID="TextBox2" runat="server"
onkeypress="return isNumberKey(event);" MaxLength="10" ></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server"
onkeypress="return isCharKey(event);" MaxLength="10" ></asp:TextBox>
add video in html
<object width="425px" height="360px" >
<param name="allowFullScreen" value="true"/>
<param name="wmode" value="transparent"/>
<param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m=5385825,t=1,mt=video,searchID=,primarycolor=,secondarycolor="/>
<embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=5385825,t=1,mt=video,searchID=,primarycolor=,secondarycolor=" width="425" height="360" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"/>
</object>
<param name="allowFullScreen" value="true"/>
<param name="wmode" value="transparent"/>
<param name="movie" value="http://mediaservices.myspace.com/services/media/embed.aspx/m=5385825,t=1,mt=video,searchID=,primarycolor=,secondarycolor="/>
<embed src="http://mediaservices.myspace.com/services/media/embed.aspx/m=5385825,t=1,mt=video,searchID=,primarycolor=,secondarycolor=" width="425" height="360" allowFullScreen="true" type="application/x-shockwave-flash" wmode="transparent"/>
</object>
view in sql server
==============================================================
View:-
==========================================================
CREATE VIEW InvoiceHeaders (customer_nbr, order_tot, ..)
AS
SELECT customer_nbr,
SUM(order_qty * unit_price),
..
FROM Invoices AS I, InvoiceDetails AS D
WHERE I.invoice_nbr = D.invoice_nbr
GROUP BY customer_nbr;
==============================================================
Large file uploads in ASP.NET,increase file upload size ,Increasing the Maximum Upload Size
Large file uploads in ASP.NET
Uploading files via the FileUpload control gets tricky with big files. The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."
Increasing the Maximum Upload Size
The 4MB default is set in machine.config, but you can override it in you web.config. For instance, to expand the upload limit to 20MB, you'd do this:
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
Since the maximum request size limit is there to protect your site, it's best to expand the file-size limit for specific directories rather than your entire application. That's possible since the web.config allows for cascading overrides. You can add a web.config file to your folder which just contains the above, or you can use the <location> tag in your main web.config to achieve the same effect:
<location path="Upload">
<system.web>
<httpRuntime executionTimeout="110" maxRequestLength="20000" />
</system.web>
</location>
Uploading files via the FileUpload control gets tricky with big files. The default maximum filesize is 4MB - this is done to prevent denial of service attacks in which an attacker submitted one or more huge files which overwhelmed server resources. If a user uploads a file larger than 4MB, they'll get an error message: "Maximum request length exceeded."
Increasing the Maximum Upload Size
The 4MB default is set in machine.config, but you can override it in you web.config. For instance, to expand the upload limit to 20MB, you'd do this:
<system.web>
<httpRuntime executionTimeout="240" maxRequestLength="20480" />
</system.web>
Since the maximum request size limit is there to protect your site, it's best to expand the file-size limit for specific directories rather than your entire application. That's possible since the web.config allows for cascading overrides. You can add a web.config file to your folder which just contains the above, or you can use the <location> tag in your main web.config to achieve the same effect:
<location path="Upload">
<system.web>
<httpRuntime executionTimeout="110" maxRequestLength="20000" />
</system.web>
</location>
sms is not sending
this code will allow to send sms
<location allowOverride="false">
<system.web>
<trust level="Full" originUrl="" />
</system.web>
</location>
<location allowOverride="false">
<system.web>
<trust level="Full" originUrl="" />
</system.web>
</location>
send sms in asp.net c#
-----------------------------------------------------------------
using System.Web.Services;
using System.Net;
public void sendsms()
{
try
{
string smsMessage = "Welcome In AEEI" + "\r";
smsMessage += txt_msg.Text.Trim();
string MobileNo = txt_mobileno.Text.Trim();
WebClient client = new WebClient();
if (MobileNo != "")
{
string baseurl = "http://sms.softhunters.in/pushsms.php?username=India Ltd.&password=293908&sender=Avyukta&to=" + MobileNo + "&message=" + smsMessage + "";
//string baseurl = "http://sms.creativeinfovision.in/pushsms.php?username=Creativeinfovision&password=your_password&sender=9829606976&to=9461816878&message=Hello";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
}
}
catch (Exception ex)
{
}
-----------------------------------------------------------------
protected void Page_Load(object sender, EventArgs e)
{
string smsMessage = "Dear Customer Congratulations!!!," + "\r";
smsMessage += "call on 91-98-220-12345 or mail @ ccare.mh@idea.adityabirla.com visit @ http://www.ideacellular.com " + "\r";
//string MobileNo = txt_telephone.Text.Trim();
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
WebClient client = new WebClient();
string no = "9887901185";
if (no != "")
{
string baseurl = "http://sms.softhunters.in/pushsms.php?username=SSMTPL&password=529670&sender=SSMTPL&to=" + no + "&message=" + smsMessage + "";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
}
}
-----------------------------------------
ON logic.Registration_Entry Time---->
-------------------------------------------
sendsms();
public void sendsms()
{
string smsMessage = "Welcome In PinkCity Gold Trading(P.)Ltd." + "\r";
smsMessage += "Your-UserID:" + usernewId + "\r";
smsMessage += "Your-SponsorID:" + sponsorid + "\r";
smsMessage += "Your-Password:" +Session["pwd"].ToString();
string MobileNo = txt_telephone.Text.Trim();
//HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
WebClient client = new WebClient();
// string baseurl = " http://sms.ziindia.com/sendurl.asp?user=20008672&pwd=12345&mobileno=9828437743&msgtext=hello h r u";
if (MobileNo != "")
{
string baseurl = "http://sms.softhunters.in/pushsms.php?username=Pinkcity Gold&password=264966&sender=Pinkcity&to=" + MobileNo + "&message=" + smsMessage + "";
//string baseurl = "http://sms.creativeinfovision.in/pushsms.php?username=Creativeinfovision&password=your_password&sender=9829606976&to=9461816878&message=Hello";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
}
}
--------------------------------------------------------------------
SMS Sending Code More than one Person
------------------------------------>
using connection_layer;
using TestWeb;
using System.IO;
using System.Net.Mail;
using System.Web.Services;
using System.Net;
public partial class Admin_Sukh_SMS_Gateway : System.Web.UI.Page
{
cls_connection con = new cls_connection();
DataSet ds = new DataSet();
DataSet dsddl = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
try
{
dsddl = con.select_data_ds("SELECT MainID, Telephone FROM EndUserAddress");
ddl_UseID.DataSource = dsddl;
ddl_UseID.DataTextField = "MainID";
ddl_UseID.DataValueField = "Telephone";
ddl_UseID.DataBind();
}
catch (Exception ex)
{
}
mul.ActiveViewIndex = 0;
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
if (RadioButtonList1.SelectedValue == "0")
{
mul.ActiveViewIndex = 1;
}
else
mul.ActiveViewIndex = 2;
}
protected void btn_send_2all_Click(object sender, EventArgs e)
{
try
{
ds = con.select_data_ds("SELECT Telephone FROM EndUserAddress");
}
catch (Exception ex)
{
}
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
WebClient client = new WebClient();
string smsMessage = txt_usermessage.Text;
for (int i = 0; i <ds.Tables[0].Rows.Count; i++)
{
string MobileNo = ds.Tables[0].Rows[i][0].ToString();
if (MobileNo != "")
{
string baseurl = "http://sms.softhunters.in/pushsms.php?username=SSMTPL&password=529670&sender=SSMTPL&to=" + MobileNo + "&message=" + smsMessage + "";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
}
}
string prompt = "<script>$(document).ready(function(){{$.prompt('{0}!');}});</script>";
string message = string.Format(prompt, "Message Has been Sent to the All Users. ");
ClientScript.RegisterStartupScript(typeof(Page), "message", message);
}
protected void btn_back_Click(object sender, EventArgs e)
{
mul.ActiveViewIndex = 0;
}
protected void btn_send_Click(object sender, EventArgs e)
{
try
{
HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache);
WebClient client = new WebClient();
string smsMessage = txt_send.Text;
string MobileNo = ddl_UseID.SelectedValue.ToString();
if (MobileNo != "")
{
string baseurl = "http://sms.softhunters.in/pushsms.php?username=SSMTPL&password=529670&sender=SSMTPL&to=" + MobileNo + "&message=" + smsMessage + "";
Stream data = client.OpenRead(baseurl);
StreamReader reader = new StreamReader(data);
string s = reader.ReadToEnd();
data.Close();
reader.Close();
string prompt = "<script>$(document).ready(function(){{$.prompt('{0}!');}});</script>";
string message = string.Format(prompt, "Message Has been Sent to the User. ");
ClientScript.RegisterStartupScript(typeof(Page), "message", message);
}
}
catch (Exception ex)
{
}
}
}
----------------------------------------------------------------------------
copy files in c# asp.net
const int BUFFSIZE = 1024;
Stream instream = File.OpenRead(Server.MapPath("images/login_icon.png"));
Stream outstream = File.OpenWrite(Server.MapPath("images/israr.png"));
byte[] buffer = new Byte[BUFFSIZE];
int numbytes;
while ((numbytes=instream.Read(buffer,0,BUFFSIZE)) > 0)
{
outstream.Write(buffer,0,numbytes);
}
instream.Close();
outstream.Close();
Stream instream = File.OpenRead(Server.MapPath("images/login_icon.png"));
Stream outstream = File.OpenWrite(Server.MapPath("images/israr.png"));
byte[] buffer = new Byte[BUFFSIZE];
int numbytes;
while ((numbytes=instream.Read(buffer,0,BUFFSIZE)) > 0)
{
outstream.Write(buffer,0,numbytes);
}
instream.Close();
outstream.Close();
unique value in database, uniqueidentifier , unique value in sql server
DECLARE @myid uniqueidentifier
SET @myid = NEWID()
PRINT 'Value of @myid is: '+ CONVERT(varchar(40), @myid)
------------------------------------
CREATE TABLE cust
(
CustomerID uniqueidentifier NOT NULL
DEFAULT newid(),
Company varchar(30) NOT NULL,
ContactName varchar(60) NOT NULL,
Address varchar(30) NOT NULL,
City varchar(30) NOT NULL,
StateProvince varchar(10) NULL,
PostalCode varchar(10) NOT NULL,
CountryRegion varchar(20) NOT NULL,
Telephone varchar(15) NOT NULL,
Fax varchar(15) NULL
)
GO
-- Inserting data into cust table.
INSERT cust
(CustomerID, Company, ContactName, Address, City, StateProvince,
PostalCode, CountryRegion, Telephone, Fax)
VALUES
(NEWID(), 'Wartian Herkku', 'Pirkko Koskitalo', 'Torikatu 38', 'Oulu', NULL,
'90110', 'Finland', '981-443655', '981-443655')
Subscribe to:
Posts (Atom)