Click here to Skip to main content
15,886,258 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerRe: Background images not displayed in asp.net page Pin
Mukund Thakker23-Aug-11 23:31
professionalMukund Thakker23-Aug-11 23:31 
AnswerRe: Background images not displayed in asp.net page Pin
Shameel27-Aug-11 4:26
professionalShameel27-Aug-11 4:26 
QuestionHow to attach mdf file to Crystal Report in VS2008 Pin
praveengb21-Aug-11 19:48
praveengb21-Aug-11 19:48 
AnswerRe: How to attach mdf file to Crystal Report in VS2008 Pin
S Douglas23-Aug-11 14:43
professionalS Douglas23-Aug-11 14:43 
GeneralRe: How to attach mdf file to Crystal Report in VS2008 Pin
praveengb23-Aug-11 19:39
praveengb23-Aug-11 19:39 
GeneralRe: How to attach mdf file to Crystal Report in VS2008 Pin
Mukund Thakker24-Aug-11 0:06
professionalMukund Thakker24-Aug-11 0:06 
AnswerRe: How to attach mdf file to Crystal Report in VS2008 Pin
Mukund Thakker24-Aug-11 2:28
professionalMukund Thakker24-Aug-11 2:28 
Questiondifficult ajax problem in mvc3 Pin
bfis10813721-Aug-11 4:58
bfis10813721-Aug-11 4:58 
I am very new to ajax (as in this is my first time trying something in ajax) but here is what I am dealing with. I am working on a db4o web server control client. Once finished, I will hopefully be using this in many other projects. What I have at this point is a connect and disconnect button to open and close the db. My code works flawlessly in Firefox but in IE and Chrome it doesn't. I have traced it to a problem where sometimes my Json value (which is just a bool) comes back as null. I stress sometimes in that for no particular reason it just happens. Sometimes it works. Sometimes it doesn't. But it always works in Firefox. However, I have debugged my server side code and the value is never coming back null. In chrome I see that the request comes back as cancelled. The http response and request regardless of successful or fail are identical other than I noticed that the request content-length varies slightly but it doesn't seem to change . This code is supposed to help me with attacks where someone could mimic my ajax request so it sends a validation token as it's body. If there's a better way then please do tell me. Here is my code.

My Jquery functions

JavaScript
<script type="text/javascript">


        $(document).ready(function () {

            $.ajaxSetup({
                cache: false,
                timeout: 5000
            });

            $("#connectButton").click(function (connect) {
                connect.preventDefault();
                $.ajax({
                    type: 'post',
                    contentType: "application/json; charset=utf-8",
                    dataType: 'Json',
                    cache: false,
                    url: 'DBAdmin/ConnectDbAjax',
                    data: $('<form>@Html.AntiForgeryToken()</form>').serialize(),
                    success: function (response) {
                        if (response) {
                            $("#disconnectButton").attr("disabled", false);
                            $("#connectButton").attr("disabled", true);
                        }
                    }
                });
            });

            $("#disconnectButton").click(function (disconnect) {
                disconnect.preventDefault();
                $.ajax({
                    type: 'post',
                    contentType: "application/json; charset=utf-8",
                    dataType: 'Json',
                    cache: false,
                    url: 'DBAdmin/DisconnectDbAjax',
                    data: $('<form>@Html.AntiForgeryToken()</form>').serialize(),
                    success: function (response) {
                        if (response) {
                            $("#connectButton").attr("disabled", false);
                            $("#disconnectButton").attr("disabled", true);
                        }
                    }
                });
            });

            

        });
</script>


My MVC functions. The validation token code is commented out because I still haven't gotten that to work yet but I think I can tackle that on my own. I am focusing on this issue for now.

C#
//[ValidateAntiForgeryToken]
        [HttpPost]
        public JsonResult ConnectDbAjax()
        {
            //DB db = new DB();
            StartServer db2 = new StartServer();
            
            //db2.StartServerFunction();
            //ConnectionResult response = new ConnectionResult();
            //response.message = "t";
            bool response = db2.StartServerFunction();
            //if(!db.CheckServer())            
            //{
            //    res.success = db.ConnectServer();
            //}
            return Json(response);
        }

        //[ValidateAntiForgeryToken]
        [HttpPost]
        public JsonResult DisconnectDbAjax()
        {
            //DB db = new DB();
            StopServer stop = new StopServer();
            //ConnectionResult discResponse = new ConnectionResult();
            //discResponse.message = "f";
            //discResponse.result = stop.StopServerFunction();
            //if (db.CheckServer())
            //{
            //    res.success = db.DisconnectServer();
            //}
            bool discResponse = stop.StopServerFunction();
            return Json(discResponse);
        }

AnswerI fixed it on my own Pin
bfis10813721-Aug-11 14:43
bfis10813721-Aug-11 14:43 
GeneralRe: I fixed it on my own Pin
Not Active21-Aug-11 15:41
mentorNot Active21-Aug-11 15:41 
QuestionSession state in asp.net C# Pin
Gaurish Gopal18-Aug-11 23:15
Gaurish Gopal18-Aug-11 23:15 
AnswerRe: Session state in asp.net C# Pin
Pravin Patil, Mumbai19-Aug-11 2:00
Pravin Patil, Mumbai19-Aug-11 2:00 
AnswerRe: Session state in asp.net C# Pin
thatraja19-Aug-11 17:24
professionalthatraja19-Aug-11 17:24 
Questiondatabase Pin
Member 808858618-Aug-11 22:23
Member 808858618-Aug-11 22:23 
SuggestionRe: database Pin
Shameel18-Aug-11 22:29
professionalShameel18-Aug-11 22:29 
AnswerRe: database Pin
#realJSOP19-Aug-11 2:15
mve#realJSOP19-Aug-11 2:15 
AnswerRe: database Pin
Keith Barrow19-Aug-11 23:02
professionalKeith Barrow19-Aug-11 23:02 
AnswerRe: database Pin
Pravin Patil, Mumbai23-Aug-11 0:16
Pravin Patil, Mumbai23-Aug-11 0:16 
Questionplz brack my licence Pin
saqibali211918-Aug-11 8:10
saqibali211918-Aug-11 8:10 
QuestionIssue with database on Asp.Net website Pin
shayalinn18-Aug-11 7:05
shayalinn18-Aug-11 7:05 
AnswerRe: Issue with database on Asp.Net website Pin
David Mujica18-Aug-11 7:38
David Mujica18-Aug-11 7:38 
GeneralRe: Issue with database on Asp.Net website Pin
shayalinn18-Aug-11 23:11
shayalinn18-Aug-11 23:11 
AnswerRe: Issue with database on Asp.Net website Pin
Shameel18-Aug-11 23:09
professionalShameel18-Aug-11 23:09 
GeneralRe: Issue with database on Asp.Net website Pin
shayalinn18-Aug-11 23:21
shayalinn18-Aug-11 23:21 
AnswerRe: Issue with database on Asp.Net website Pin
Raman Ghantiyala30-Aug-11 20:10
Raman Ghantiyala30-Aug-11 20:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.