Code Not Working Well In Server

Jul 7, 2010

Its regarding send mail via c#.net. The following code is working well in my local machine, upload it in server but its not working in server. I m using same smtp server name , email username , password in local and server. But i don't know what is problem? problem is in my coding?

System.Net.Mail.MailMessage objEmail = new System.Net.Mail.MailMessage();
objEmail.From = new MailAddress(dsAdmin.Tables[0].Rows[0]["Emailusername"].ToString());
objEmail.To.Add(To_Tmail.ToString());
objEmail.IsBodyHtml = true;
objEmail.Subject = Subject.ToString();
objEmail.Body = message.ToString() + dsAdmin.Tables[0].Rows[0]["Emailsignature"].ToString();
SmtpClient client = new SmtpClient();
System.Net.NetworkCredential SMTPUserInfo = new System.Net.NetworkCredential(dsAdmin.Tables[0].Rows[0]["Emailusername"].ToString(), dsAdmin.Tables[0].Rows[0]["Password"].ToString());
client.UseDefaultCredentials = false;
client.Credentials = SMTPUserInfo;
client.Host = dsAdmin.Tables[0].Rows[0]["SMTPservername"].ToString();
client.DeliveryMethod = SmtpDeliveryMethod.Network;
client.Port = 587;
try
{
client.Send(objEmail);
res = true;
catch (Exception exc)
{
res = false;
}

View 5 Replies


Similar Messages:

Server-side Code Is Not Working?

Oct 21, 2010

i am added one button on user control it is working fine locally but not working on server my error is CS1061: 'ASP.templates_categories_productsingrid_ascx' does not contain a definition for 'dl_viewall' and no extension method 'dl_viewall' accepting a first argument of type 'ASP.templates_categories_productsingrid_ascx' could be found (are you missing a using directive or an assembly reference?)

View 2 Replies

Web Forms :: Want A Confirm Box From Server Side Code But It's Not Working?

Jan 9, 2011

i want a confirm box from server side code but it's not working

a= a+", "+texbox1.text;

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "confirm", "<script>return confirm('"+a+"'File Already Exists do you want to replace!');</script>");

View 4 Replies

Configuration :: Compile Code Working In Localhost, But Can't Work On Server?

Jan 18, 2011

I previously crate website in framework 2.0 before one year and there is working good on server. But Currently I download same site on my local machine and configure again in Visual Studio 2008 with framework 2.0 compiler then do new changes on site and it running good on localhost.But the same code I upload on server again They can't work code properly.In new code I changes some XML file that retrieve data and save data, but I add new code in this XML file so it can't work with new code but previous code is working as good as previous.

View 3 Replies

Configuration :: Application Is Working Fine In Local Environment But Not Working After Push Code In Live

Aug 19, 2010

My application is working fine in local environment but not working after push code in live. My locale environment and hosting environment both are having same configuration. Same app working fine 2 month before but in different domain but same hosting server.

how to check the both config / any possible to run debug mode in hosting server please let me know. below code used in all page for checking user session status but when I click on any link page redirect to login.aspx I think session got timeout. I don't know why session got time frequently, but this issue not happening in local environment (desktop).

[Code]....
[Code]....

View 6 Replies

Web Forms :: Code Write File 2.0 Is Working In Firefox But IE Not Working

Aug 28, 2010

If Not IsDBNull(ext) Then
ext = LCase(ext)
End If
Select Case ext
'Case ".htm", ".html"
' type = "text/HTML"
'Case ".txt"
' type = "text/plain"
'Case ".doc", ".rtf"
' type = "Application/msword"
'Case ".csv", ".xls"
' type = "Application/x-msexcel"........................

View 5 Replies

Moving The Javascript Code To Design View Is Not Working. Only Code-behind Attributes.Add ("onclick" Works. Puzzled

Jul 15, 2010

I wanted to disable a button after it is clicked and at the same time fire the post back event to generate a report. My first set of code did not work because soon after the button is disabled the page won't submit/post back. here's the first set of code which was not implemented. the onclientclick calls a javascript function which has these lines

document.getElementById('btnGenerateReport').disabled=true;
GetPostBackEventReference(btnGenerateReport,'');

since it was not posting back,i tried the following on page_load code behind

btnGenerateReport.Attributes.Add("onclick", "this.disabled=true;" + ClientScript.GetPostBackEventReference(btnGenerateReport, ""))

that worked well. but I tried to copy the javascript that got generated and pasted directly on design view

onclick="this.disabled=true;__doPostBack('btnDownloadClientsWithConviction','');"

its not working from client side alone after I disable the code behind attributes.add
but when I check the view source the 2 pages are the samewhy am I not able to move the code from code-behind to design view?

View 1 Replies

Web Forms :: Url Rewriting Not Working On Live Server In Asp.net But Locally Working Fine

Feb 23, 2010

Url rewriting not working on live server in asp.net but locally working fine. but locally it's not case sensitive.

View 1 Replies

Security :: Login Control - Redirect Not Working On Server - Working On Localhost

Feb 21, 2011

I have a login control that is working beautifully on my localhost, but not working on the server. It validates my username & password - and gives me an error if I enter an invalid username/password. However, if I enter the correct username/password, the page refreshes, but does not redirect me to the "ReturnUrl" that I see in the URL. I've seen posts on this, but nothing that I tried worked. I've tried setting the 'MembershipProvider'attribute of the login control. I don't want to set the DestinationUrl...I want it to take what is in the ReturnUrl in the querystring. I don't think it's a web.config issue cuz it works on localhost??

View 3 Replies

Delete Trigger Is Not Working When Fire From C# But Working In Sql Server?

Aug 5, 2010

i made a after delete trigger on a table1 and in this trigger i insert the deleted data in another table name tab2.

when i execute the delete stored procedure of table1 from sql server 2005 then trigger working fine but when i execute delete stored procedure of table1 from c# then it is not working properly.

View 1 Replies

'urlMappings' Not Working On Server But Working In Development?

Feb 12, 2010

I have created a dynamic Robots.txt file for my application and I have created an redirect entry in my web config in the <system.web> section and it works perfectly in my development environment but once I uploaded the file to my server it does not work and gives me an error 404.Requested URLhttp://www.canadawelcome.ca:80/robots.txt

Physical Path
E:webcanadawelc1htdocs
obots.txt

This is what I have added to my system.web section

View 1 Replies

C# - Invoking Server Code After Client Code For A Control INSIDE AJAX PANEL?

Jul 30, 2010

I've the Javascript code to do a confirmation before deletion of some records

function confirmDelete()
{
if(confirm('Delete all?'))
{
return true;
}
else
{
return false;
}
}

I've the button code here

<asp:Button ID="btnDelete" runat="server" onClientClick="return confirmDelete();" onClick="btnDelete_click" />

If i've the button outside an update panel (basically i'm using RadAjaxPanel by Telerik) it is working fine. But when the button is inside an ajax panel, even if i click OK for deleting the records the server side code is not called.

View 2 Replies

Call Javascript Function From Code Behind After Server Side Code Executes

May 25, 2010

I have an asp.net button, that when clicked calls a code behind function. The function does some evaluation, and then I want to call javascript from within this asp.net function.

View 2 Replies

CSS Code Is Not Working In IE 6?

May 26, 2010

this is the code for menu CSS code. It will work on Firefox but not in IE6.

.menu li a:hover .menu ul li:hover a{
background-image:url(images/ye.jpg);
color:#000000;
text-decoration:none;
}

View 4 Replies

Working With Sql Datasource In Code Behind?

Jan 21, 2010

i have sp in sql server 2000 naed as get_job_by_jobType and it execute as returning table rows and get thedata in sql datasouce and i want to bind it on gridview,and i m executing storedprocedure on the basis of selectitem from dropdownlist.please tell me hwo to write code in code behind
Code:
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Response.Write(DropDownList1.SelectedItem.Text)
' Me.GridView1.DataSource = DataSourceID
Me.GridView1.DataSourceID = Me.SqlDataSource4.ToString()

End Sub

above statment giving me errors(exception)

View 7 Replies

VS 2005 - Code Not Working?

Jun 16, 2010

Code:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

[code]....

no alert box is displayed when i left the textbox blank and clicked the button

View 37 Replies

Web Forms :: Code Behind Not Working In FF?

Jan 28, 2010

Ok so I have my aspx pages. They work and display fine in IE, but dont do a think in FF. Perfect example is the home page, it has a large image that is set a url that is retrieved from my db in the code behind:

// add main image of home page

imgMain.ImageUrl =

DAL.imagePath();

[Code]....

View 5 Replies

Login Code (c#) Is Not Working

Apr 26, 2010

I've made a login page but I seem to have missed something and I guess I've become blind to the code because I can't find what's wrong with it. I'm sorry some of it's in swedish. There's no error message when I test the login, the program just stays on the login page.

Login page (aspx.cs):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Text;
using System.IO;
public partial class Start : System.Web.UI.Page
{
string config = System.Configuration.ConfigurationManager.ConnectionStrings["InteraktivaFĂreningenConnectionString1"].ToString();
protected void Page_Load(object sender, EventArgs e)
{
this.TextBoxAnvändarnamn.Focus();
}
protected void ButtonLoggaIn_Click(object sender, EventArgs e) //login-button
{
//kontroll av användarnamn och lĂsenord - controls username and password
try
{
SqlConnection conn = new SqlConnection(config);
{
conn.Open();
string Användarnamn = this.TextBoxAnvändarnamn.Text; //username
string LĂsenord = this.TextBoxLĂsenord.Text; //password
string sql = "SELECT Login.anvandarnamn, Login.losenord, Medlem.ID FROM Login, Medlem WHERE anvandarnamn = '" + Användarnamn + "' AND '" + Session["användarnamn"] + "'";
SqlCommand comm = new SqlCommand(sql, conn);
SqlDataReader dr = comm.ExecuteReader();
{
try
{
dr.Read();
if (Convert.ToString(dr["anvandarnamn"]) == Användarnamn) //username
{
Session["användarnamn"] = TextBoxAnvändarnamn.Text; //username
Session["medlemID"] = dr["medlemID"].ToString(); //memberID
if (Convert.ToString(dr["losenord"]) == LĂsenord)
{
HämtaID(); //getID
Response.Redirect("MĂten.aspx");
}
else
{
string scriptet = "<script>alert('LĂsenordet är felaktigt. Prova igen');</script>"; //wrong password
ClientScript.RegisterStartupScript(scriptet.GetType(), "FelLĂsen", scriptet);
TextBoxLĂsenord.Focus();
}
}
}
catch (Exception)
{
string scriptet = "<script>alert('Användarnamnet är felaktigt. Prova igen.');</script>"; //wrong username
ClientScript.RegisterStartupScript(scriptet.GetType(), "FelAnvändarnamn", scriptet);
TextBoxAnvändarnamn.Focus();
}
dr.Close();
conn.Close();
}
}
}
catch (Exception)
{
}
}
//gets and creates session variables of username and memberID
public void HämtaID() //getID
{
try
{
SqlConnection conn = new SqlConnection(config);
{
conn.Open();
string Användarnamn = this.TextBoxAnvändarnamn.Text; //username
string sql = "SELECT fornamn, efternamn, ID FROM Medlem WHERE ID = '" + Session["medlemID"] + "'";
SqlCommand comm = new SqlCommand(sql, conn);
SqlDataReader dr = comm.ExecuteReader();
{
while (dr.Read())
{
Session["medlemID"] = dr["medlemID"].ToString(); //memberID
Session["användarnamn"] = dr["fornamn"].ToString() + " " + dr["efternamn"].ToString(); //username
}
}
dr.Close();
conn.Close();
}
}
catch (Exception)
{
}
}
}

View 16 Replies

JQuery Code Not Working In IE 8?

Feb 1, 2011

This code is working in firefox but on IE 8 it returns nothing

<script type="text/javascript">
$(document).ready(function(){
var pageUrl = '<%=ResolveUrl("~/test/test.aspx")%>';
// Test
$('#<%=ddlTest.ClientID%>').change(function(){
var trgId = $(this+'input:checked').val();
$.ajax({
type: "POST",........

View 1 Replies

C# - CSS Call From Code Behind Not Working?

Mar 8, 2010

I have the following entries in the css file.

a.intervalLinks { font-size:11px; font-weight:normal; color:#003399; text-decoration:underline; margin:0px 16px 0px 0px; }
a.intervalLinks:link { text-decoration:underline; }
a.intervalLinks:hover { text-decoration:none; }
a.intervalLinks:visited { text-decoration:underline; }
a.selectedIntervalLink { font-size:12px; font-weight:bold; color:#003399; text-decoration:none; margin:0px 16px 0px 0px; }
a.intervalLinks:active { text-decoration:underline; font-size:large ; }

Edited for trial:

a.big-link:link{}
a.big-link:visited {}
a.big-link:hover{}
a.big-link:active{font-size:1em;}

Whenever i take the click on some links (not shown) which is embedded in the webpage ..i can see the change in the link

a.intervalLinks:active { text-decoration:underline; font-size:large ;

(the font of the link will become large)

but after clicking the page refreshes ..the changes will go away

i want to keep the change for ever in that link ...even there is a page refresh

i understood that ..this can achieved only throughg the code behind of asp.net

Following code should work:but unfortunately its not

protected override void OnInit(EventArgs e)
{
rptDeptList.ItemDataBound += new RepeaterItemEventHandler(rptDeptList_ItemDataBound);
}
void rptDeptList_ItemDataBound(object sender, RepeaterItemEventArgs e)

[Code]....

View 3 Replies

Javascript Code Not Working?

Jan 19, 2010

<script language="JavaScript" type="text/javascript">
if (location.href.indexOf('?dest=') > 0)
window.open('/about.aspx', '', '')
</script>

how do i make this work. Its in aspx file.

View 3 Replies

MVC : AJAX Methods - Code Is Not Working

Jul 22, 2010

Below is some code. The save() method was pre-existing. I added the saveRanking() method. When I walk through the code, it hits the method, but then it just bails out of it. No exception (that I can see). Do I need that function(data) part?
Code:
function save() {
$.post(
"/Applications/SaveStatus",
[code]....

View 1 Replies

JQuery :: Why This Code Is Not Working As Expected

Dec 18, 2010

[Code]....
[Code]....

//Ideally this should hide al the anchor tags with in tr tag. But this piece of code is not working as expected. nothing is fading out. [Code]....

View 3 Replies

Javascript Code In Iframes In IE9 Not Working?

Apr 1, 2011

I've a very complete site in ASP.NET wich uses iframes. I'm working to change an old control we'd been using to show dialogs to use jQuery UI dialogs. I'm also making sure everything works well in IE9.

The fact is: the script I've in the pages shown in iframes is not working in IE9. Why? Because Object, Array and String are undefined. There may be some others issues, I've seen only this ones.

There is no chance (because a lot of reasons) to stop using iframes on some dialogs. And I'd rather not to use the meta tag to force IE8 Compability. Does anyone know any way to fix this uggly bug in IE9?

Edit

Here there's some info that may be helfull:

jQuery code for the iframe in a plugin I've made to config jQuery UI dialog:

options.content = $("<iframe>")
.attr("src", options.intSrcIframe)
.attr("frameborder", 0)
.attr("scrolling", options.intIframeScrolling)
.css("background-color", options.intBgColorIframe)
.attr("height", "100%")
.attr("width", "100%");
_this.html(options.content);

View 1 Replies

C# - Pro Net MVC Framework Sample Code Not Working

Oct 21, 2010

This is from a very good book by Steven SandersonI am trying to follow the chapter 4 and trying to setup IOC on my mvc code from the code sample of the book but its not working.I follow the code from page 97 to page 101 where I set up Inversion of Control and run the code but I get the following error. A dialog box opens trying to search the following file:

c:TeamCityuildAgentwork1ab5e0b25b145b19srcCastle.WindsorWindsorWindsorContainer.cs
protected override IController GetControllerInstance(
System.Web.Routing.RequestContext requestContext,
Type controllerType)
[code]...

View 3 Replies







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